[anjuta/gnome-2-32] libanjuta: bgo#633042 New: Sensitivity off 'ok' button on the project import dialog
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/gnome-2-32] libanjuta: bgo#633042 New: Sensitivity off 'ok' button on the project import dialog
- Date: Fri, 12 Nov 2010 13:55:51 +0000 (UTC)
commit c0a849baa5298a8de998b394134974347144a651
Author: Nanci de Brito Bonfim <nancibonfim gmail com>
Date: Mon Oct 25 14:30:28 2010 +0200
libanjuta: bgo#633042 New: Sensitivity off 'ok' button on the project import dialog
libanjuta/anjuta-plugin-manager.c | 58 +++++++++++++++++++++++++++++++++++--
libanjuta/anjuta-plugin-manager.h | 9 ++---
plugins/file-loader/plugin.c | 2 +-
3 files changed, 60 insertions(+), 9 deletions(-)
---
diff --git a/libanjuta/anjuta-plugin-manager.c b/libanjuta/anjuta-plugin-manager.c
index 4f59fa5..3226496 100644
--- a/libanjuta/anjuta-plugin-manager.c
+++ b/libanjuta/anjuta-plugin-manager.c
@@ -1355,7 +1355,7 @@ get_plugin_factory (AnjutaPluginManager *plugin_manager,
descs = g_list_reverse (descs);
obj = anjuta_plugin_manager_select_and_activate (plugin_manager,
_("Select a plugin"),
- _("Please select a plugin to activate"),
+ _("<b>Please select a plugin to activate</b>"),
descs);
g_list_free (descs);
}
@@ -1506,7 +1506,7 @@ anjuta_plugin_manager_get_plugin (AnjutaPluginManager *plugin_manager,
descs = g_list_reverse (descs);
obj = anjuta_plugin_manager_select_and_activate (plugin_manager,
_("Select a plugin"),
- _("Please select a plugin to activate"),
+ _("<b>Please select a plugin to activate</b>"),
descs);
g_list_free (descs);
return obj;
@@ -1871,6 +1871,51 @@ on_plugin_list_row_activated (GtkTreeView *tree_view,
gtk_dialog_response (dialog, GTK_RESPONSE_OK);
}
+
+static void
+on_plugin_list_show (GtkTreeView *view,
+ GtkDialog *dialog)
+{
+ GtkTreeSelection *selection;
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+
+ g_signal_emit_by_name (G_OBJECT (selection), "changed", GTK_DIALOG(dialog), NULL);
+}
+
+
+static void
+on_plugin_list_selection_changed (GtkTreeSelection *tree_selection,
+ GtkDialog *dialog)
+{
+ GtkContainer *action_area;
+ GList *list;
+ GtkButton *bt = NULL;
+
+ action_area = (GtkContainer *) dialog->action_area;
+ list = gtk_container_get_children (action_area);
+ for (; list; list = list->next) {
+ bt = list->data;
+ if (!strcmp("gtk-ok", gtk_button_get_label (bt)))
+ break;
+ }
+ if (bt && gtk_tree_selection_get_selected (tree_selection, NULL, NULL))
+ gtk_widget_set_sensitive ((GtkWidget *) bt, TRUE);
+ else
+ gtk_widget_set_sensitive ((GtkWidget *) bt, FALSE);
+ g_list_free(list);
+}
+
+/*
+ * anjuta_plugin_manager_select:
+ * @plugin_manager: #AnjutaPluginManager object
+ * @title: Title of the dialog
+ * @description: label shown on the dialog
+ * @plugin_descriptions: List of #AnjutaPluginDescription
+ *
+ * Show a dialog where the user can choose between the given plugins
+ *
+ * Returns: The chosen plugin description
+ */
AnjutaPluginDescription *
anjuta_plugin_manager_select (AnjutaPluginManager *plugin_manager,
gchar *title, gchar *description,
@@ -1910,7 +1955,6 @@ anjuta_plugin_manager_select (AnjutaPluginManager *plugin_manager,
GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
- gtk_widget_set_size_request (dlg, 400, 300);
gtk_window_set_default_size (GTK_WINDOW (dlg), 400, 300);
label = gtk_label_new (description);
@@ -1958,6 +2002,14 @@ anjuta_plugin_manager_select (AnjutaPluginManager *plugin_manager,
g_signal_connect (view, "row-activated",
G_CALLBACK (on_plugin_list_row_activated),
GTK_DIALOG(dlg));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(on_plugin_list_selection_changed),
+ GTK_DIALOG(dlg));
+ g_signal_connect(view, "focus",
+ G_CALLBACK(on_plugin_list_show),
+ GTK_DIALOG(dlg));
+
remember_checkbox =
gtk_check_button_new_with_label (_("Remember this selection"));
gtk_container_set_border_width (GTK_CONTAINER (remember_checkbox), 10);
diff --git a/libanjuta/anjuta-plugin-manager.h b/libanjuta/anjuta-plugin-manager.h
index 08d95ce..422da50 100644
--- a/libanjuta/anjuta-plugin-manager.h
+++ b/libanjuta/anjuta-plugin-manager.h
@@ -111,11 +111,10 @@ AnjutaPluginDescription* anjuta_plugin_manager_select (AnjutaPluginManager *plug
gchar *title, gchar *description,
GList *plugin_descriptions);
-/* Returns the plugin that has been selected and activated */
-GObject* anjuta_plugin_manager_select_and_activate (AnjutaPluginManager *plugin_manager,
- gchar *title,
- gchar *description,
- GList *plugin_descriptions);
+
+GObject* anjuta_plugin_manager_select_and_activate (AnjutaPluginManager *plugin_manager,
+ gchar *title, gchar *description,
+ GList *plugin_descriptions);
void anjuta_plugin_manager_activate_plugins (AnjutaPluginManager *plugin_manager,
GList *plugin_descs);
diff --git a/plugins/file-loader/plugin.c b/plugins/file-loader/plugin.c
index 9679e5b..6580073 100644
--- a/plugins/file-loader/plugin.c
+++ b/plugins/file-loader/plugin.c
@@ -1438,7 +1438,7 @@ iloader_load (IAnjutaFileLoader *loader, GFile* file,
basename);
plugin =
anjuta_plugin_manager_select_and_activate (plugin_manager,
- _("Open With"),
+ _("<b>Open With</b>"),
message,
plugin_descs);
g_free (basename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]