mirror of https://github.com/GNOME/gimp.git
when the notebook page is changed with the mouse wheel, update the title
* app/dialogs/preferences-dialog.c: when the notebook page is changed with the mouse wheel, update the title and the selection in the treeview.
This commit is contained in:
parent
08c1c36a32
commit
ae1d7503cc
|
@ -1,3 +1,9 @@
|
|||
2005-07-31 DindinX <dindinx@gimp.org>
|
||||
|
||||
* app/dialogs/preferences-dialog.c: when the notebook page is changed
|
||||
with the mouse wheel, update the title and the selection in the
|
||||
treeview.
|
||||
|
||||
2005-07-31 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/tools/Makefile.am
|
||||
|
|
|
@ -76,6 +76,10 @@ static void prefs_response (GtkWidget *widget,
|
|||
gint response_id,
|
||||
GtkWidget *dialog);
|
||||
|
||||
static void prefs_notebook_page_callback (GtkNotebook *notebook,
|
||||
GtkNotebookPage *page,
|
||||
guint page_num,
|
||||
GtkTreeSelection *sel);
|
||||
static void prefs_resolution_source_callback (GtkWidget *widget,
|
||||
GObject *config);
|
||||
static void prefs_resolution_calibrate_callback (GtkWidget *widget,
|
||||
|
@ -797,12 +801,78 @@ prefs_tree_select_callback (GtkTreeSelection *sel,
|
|||
|
||||
gtk_tree_model_get_value (model, &iter, 2, &val);
|
||||
|
||||
g_signal_handlers_block_by_func (notebook,
|
||||
prefs_notebook_page_callback,
|
||||
sel);
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook),
|
||||
g_value_get_int (&val));
|
||||
g_signal_handlers_unblock_by_func (notebook,
|
||||
prefs_notebook_page_callback,
|
||||
sel);
|
||||
|
||||
g_value_unset (&val);
|
||||
}
|
||||
|
||||
static void
|
||||
prefs_notebook_page_callback (GtkNotebook *notebook,
|
||||
GtkNotebookPage *page,
|
||||
guint page_num,
|
||||
GtkTreeSelection *sel)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeIter child_iter;
|
||||
GtkTreeView *view;
|
||||
GValue val = { 0, };
|
||||
gint val_int;
|
||||
gint num_children;
|
||||
gint i;
|
||||
|
||||
view = gtk_tree_selection_get_tree_view (sel);
|
||||
model = gtk_tree_view_get_model (view);
|
||||
|
||||
if (gtk_tree_model_get_iter_first (model, &iter))
|
||||
{
|
||||
do
|
||||
{
|
||||
gtk_tree_model_get_value (model, &iter, 2, &val);
|
||||
|
||||
val_int = g_value_get_int (&val);
|
||||
g_value_unset (&val);
|
||||
|
||||
if (val_int == page_num)
|
||||
{
|
||||
gtk_tree_selection_select_iter (sel, &iter);
|
||||
return;
|
||||
}
|
||||
if (gtk_tree_model_iter_has_child (model, &iter))
|
||||
{
|
||||
num_children = gtk_tree_model_iter_n_children (model, &iter);
|
||||
|
||||
for (i = 0; i < num_children; i++)
|
||||
{
|
||||
gtk_tree_model_iter_nth_child (model, &child_iter, &iter, i);
|
||||
gtk_tree_model_get_value (model, &child_iter, 2, &val);
|
||||
|
||||
val_int = g_value_get_int (&val);
|
||||
g_value_unset (&val);
|
||||
|
||||
if (val_int == page_num)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
|
||||
path = gtk_tree_model_get_path (model, &child_iter);
|
||||
gtk_tree_view_expand_to_path (view, path);
|
||||
gtk_tree_selection_select_iter (sel, &child_iter);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (gtk_tree_model_iter_next (model, &iter));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
prefs_format_string_select_callback (GtkTreeSelection *sel,
|
||||
GtkEntry *entry)
|
||||
|
@ -1319,6 +1389,9 @@ prefs_dialog_new (Gimp *gimp,
|
|||
g_signal_connect (sel, "changed",
|
||||
G_CALLBACK (prefs_tree_select_callback),
|
||||
notebook);
|
||||
g_signal_connect (notebook, "switch-page",
|
||||
G_CALLBACK (prefs_notebook_page_callback),
|
||||
sel);
|
||||
|
||||
page_index = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue