Add an important column.
2003-08-13 Anders Carlsson <andersca@gnome.org> * tests/testtoolbar.c: (set_important_func), (important_toggled), (create_items_list): Add an important column.
This commit is contained in:
committed by
Anders Carlsson
parent
b3bafcf180
commit
296c4b41bf
@ -1,3 +1,9 @@
|
||||
2003-08-13 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* tests/testtoolbar.c: (set_important_func), (important_toggled),
|
||||
(create_items_list):
|
||||
Add an important column.
|
||||
|
||||
Tue Aug 12 15:00:15 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_real_set_focus): Protect
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
2003-08-13 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* tests/testtoolbar.c: (set_important_func), (important_toggled),
|
||||
(create_items_list):
|
||||
Add an important column.
|
||||
|
||||
Tue Aug 12 15:00:15 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_real_set_focus): Protect
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
2003-08-13 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* tests/testtoolbar.c: (set_important_func), (important_toggled),
|
||||
(create_items_list):
|
||||
Add an important column.
|
||||
|
||||
Tue Aug 12 15:00:15 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_real_set_focus): Protect
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
2003-08-13 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* tests/testtoolbar.c: (set_important_func), (important_toggled),
|
||||
(create_items_list):
|
||||
Add an important column.
|
||||
|
||||
Tue Aug 12 15:00:15 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_real_set_focus): Protect
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
2003-08-13 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* tests/testtoolbar.c: (set_important_func), (important_toggled),
|
||||
(create_items_list):
|
||||
Add an important column.
|
||||
|
||||
Tue Aug 12 15:00:15 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_real_set_focus): Protect
|
||||
|
||||
@ -235,6 +235,38 @@ homogeneous_toggled(GtkCellRendererToggle *cell, const gchar *path_str,
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_important_func(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
|
||||
GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
GtkToolItem *tool_item;
|
||||
|
||||
gtk_tree_model_get (model, iter, 0, &tool_item, -1);
|
||||
|
||||
g_object_set (G_OBJECT (cell), "active", gtk_tool_item_get_is_important (tool_item), NULL);
|
||||
g_object_unref (tool_item);
|
||||
}
|
||||
|
||||
static void
|
||||
important_toggled(GtkCellRendererToggle *cell, const gchar *path_str,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
GtkToolItem *tool_item;
|
||||
|
||||
path = gtk_tree_path_new_from_string (path_str);
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
|
||||
gtk_tree_model_get (model, &iter, 0, &tool_item, -1);
|
||||
gtk_tool_item_set_is_important (tool_item, !gtk_tool_item_get_is_important (tool_item));
|
||||
g_object_unref (tool_item);
|
||||
|
||||
gtk_tree_model_row_changed (model, path, &iter);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
static GtkListStore *
|
||||
create_items_list (GtkWidget **tree_view_p)
|
||||
{
|
||||
@ -283,6 +315,14 @@ create_items_list (GtkWidget **tree_view_p)
|
||||
cell,
|
||||
set_homogeneous_func, NULL,NULL);
|
||||
|
||||
cell = gtk_cell_renderer_toggle_new ();
|
||||
g_signal_connect (cell, "toggled", G_CALLBACK (important_toggled),
|
||||
list_store);
|
||||
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (tree_view),
|
||||
-1, "Important",
|
||||
cell,
|
||||
set_important_func, NULL,NULL);
|
||||
|
||||
g_object_unref (list_store);
|
||||
|
||||
*tree_view_p = tree_view;
|
||||
|
||||
Reference in New Issue
Block a user