app/widgets/gimpcontrollereditor.c set tooltips dynamically.

2006-03-04  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpcontrollereditor.c
	* app/widgets/gimpcontrollerlist.c: set tooltips dynamically.
This commit is contained in:
Sven Neumann 2006-03-04 00:41:15 +00:00 committed by Sven Neumann
parent e09c3f2da6
commit 303fd1993a
3 changed files with 55 additions and 20 deletions

View File

@ -1,3 +1,8 @@
2006-03-04 Sven Neumann <sven@gimp.org>
* app/widgets/gimpcontrollereditor.c
* app/widgets/gimpcontrollerlist.c: set tooltips dynamically.
2006-03-03 Sven Neumann <sven@gimp.org>
* app/dialogs/vectors-import-dialog.c (vectors_import_dialog_new)

View File

@ -408,11 +408,7 @@ gimp_controller_editor_constructor (GType type,
G_CALLBACK (gimp_controller_editor_edit_clicked),
editor);
gimp_help_set_help_data (editor->edit_button,
_("Assign an action to the selected event"),
NULL);
editor->delete_button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
editor->delete_button = gtk_button_new_from_stock (GTK_STOCK_CLEAR);
gtk_box_pack_start (GTK_BOX (hbox), editor->delete_button, TRUE, TRUE, 0);
gtk_widget_show (editor->delete_button);
@ -420,10 +416,6 @@ gimp_controller_editor_constructor (GType type,
G_CALLBACK (gimp_controller_editor_delete_clicked),
editor);
gimp_help_set_help_data (editor->delete_button,
_("Remove the action from the selected event"),
NULL);
gtk_widget_set_sensitive (editor->edit_button, FALSE);
gtk_widget_set_sensitive (editor->delete_button, FALSE);
@ -521,14 +513,18 @@ gimp_controller_editor_sel_changed (GtkTreeSelection *sel,
{
GtkTreeModel *model;
GtkTreeIter iter;
gchar *edit_help = NULL;
gchar *delete_help = NULL;
gboolean edit_sensitive = FALSE;
gboolean delete_sensitive = FALSE;
if (gtk_tree_selection_get_selected (sel, &model, &iter))
{
gchar *event = NULL;
gchar *action = NULL;
gtk_tree_model_get (model, &iter,
COLUMN_BLURB, &event,
COLUMN_ACTION, &action,
-1);
@ -537,13 +533,23 @@ gimp_controller_editor_sel_changed (GtkTreeSelection *sel,
g_free (action);
delete_sensitive = TRUE;
delete_help =
g_strdup_printf (_("Remove the action assigned to '%s'"), event);
}
edit_sensitive = TRUE;
edit_help = g_strdup_printf (_("Assign an action to '%s'"), event);
g_free (event);
}
gtk_widget_set_sensitive (editor->edit_button, edit_sensitive);
gimp_help_set_help_data (editor->edit_button, edit_help, NULL);
gtk_widget_set_sensitive (editor->edit_button, edit_sensitive);
g_free (edit_help);
gimp_help_set_help_data (editor->delete_button, delete_help, NULL);
gtk_widget_set_sensitive (editor->delete_button, delete_sensitive);
g_free (delete_help);
gimp_controller_info_set_event_snooper (editor->info, NULL, NULL);
}
@ -798,6 +804,8 @@ gimp_controller_editor_edit_response (GtkWidget *dialog,
g_free (event_name);
g_free (stock_id);
g_free (action_name);
gimp_controller_editor_sel_changed (editor->edit_sel, editor);
}
gtk_widget_destroy (dialog);

View File

@ -243,10 +243,6 @@ gimp_controller_list_init (GimpControllerList *list)
gtk_container_add (GTK_CONTAINER (list->add_button), image);
gtk_widget_show (image);
gimp_help_set_help_data (list->add_button,
_("Create a controller of the selected type."),
NULL);
g_signal_connect (list->add_button, "clicked",
G_CALLBACK (gimp_controller_list_add_clicked),
list);
@ -263,10 +259,6 @@ gimp_controller_list_init (GimpControllerList *list)
gtk_container_add (GTK_CONTAINER (list->remove_button), image);
gtk_widget_show (image);
gimp_help_set_help_data (list->remove_button,
_("Remove the selected filter from the list of "
"active filters."), NULL);
g_signal_connect (list->remove_button, "clicked",
G_CALLBACK (gimp_controller_list_remove_clicked),
list);
@ -416,21 +408,38 @@ gimp_controller_list_src_sel_changed (GtkTreeSelection *sel,
{
GtkTreeModel *model;
GtkTreeIter iter;
gchar *tip = NULL;
if (gtk_tree_selection_get_selected (sel, &model, &iter))
{
gchar *name;
gtk_tree_model_get (model, &iter,
COLUMN_NAME, &name,
COLUMN_TYPE, &list->src_gtype,
-1);
if (list->add_button)
gtk_widget_set_sensitive (list->add_button, TRUE);
{
tip =
g_strdup_printf (_("Add '%s' to the list of active controllers"),
name);
gtk_widget_set_sensitive (list->add_button, TRUE);
}
g_free (name);
}
else
{
if (list->add_button)
gtk_widget_set_sensitive (list->add_button, FALSE);
}
if (list->add_button)
{
gimp_help_set_help_data (list->add_button, tip, NULL);
g_free (tip);
}
}
static void
@ -456,7 +465,20 @@ gimp_controller_list_select_item (GimpContainerView *view,
selected = GIMP_IS_CONTROLLER_INFO (list->dest_info);
if (list->remove_button)
gtk_widget_set_sensitive (list->remove_button, selected);
{
GimpObject *object = GIMP_OBJECT (list->dest_info);
gchar *tip = NULL;
gtk_widget_set_sensitive (list->remove_button, selected);
if (selected)
tip =
g_strdup_printf (_("Remove '%s' from the list of active controllers"),
gimp_object_get_name (object));
gimp_help_set_help_data (list->remove_button, tip, NULL);
g_free (tip);
}
gtk_widget_set_sensitive (list->edit_button, selected);
gtk_widget_set_sensitive (list->up_button, selected);