[anjuta] about: make the About dialogs transient and modal



commit 667c33d21458e025a9df1553d143d74b0030c1e0
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 28 11:39:57 2011 -0400

    about: make the About dialogs transient and modal
    
    This makes mutter apply the right modal style to the dialogs, like for
    other GNOME 3 applications.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645965

 src/about.c            |   19 +++++++++++++++----
 src/about.h            |    2 +-
 src/action-callbacks.c |    6 +++---
 src/action-callbacks.h |    2 +-
 4 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/src/about.c b/src/about.c
index 3df4262..e47bf6f 100644
--- a/src/about.c
+++ b/src/about.c
@@ -170,7 +170,7 @@ about_free_credit(void)
 }
 
 GtkWidget *
-about_box_new ()
+about_box_new (GtkWindow *parent)
 {
 	GtkWidget *dialog;
 	GdkPixbuf *pix;
@@ -196,6 +196,9 @@ about_box_new ()
 									NULL);
 	
 	dialog = gtk_about_dialog_new();
+	gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
+	gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
+
 	gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(dialog), "Anjuta");
 	gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), VERSION);
 	gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog), 
@@ -220,7 +223,7 @@ about_box_new ()
 }
 
 static void
-on_about_plugin_activate (GtkMenuItem *item, AnjutaPluginDescription *desc)
+on_about_plugin_activate (GtkMenuItem *item, AnjutaShell *shell)
 {
 	gchar *name = NULL;
 	gchar *authors = NULL;
@@ -230,7 +233,10 @@ on_about_plugin_activate (GtkMenuItem *item, AnjutaPluginDescription *desc)
 	gchar *d = NULL;
 	GdkPixbuf *pix = NULL;
 	GtkWidget *dialog;
-	
+	AnjutaPluginDescription *desc;
+
+	desc = g_object_get_data (G_OBJECT (item), "plugin-desc");
+
 	anjuta_plugin_description_get_locale_string (desc, "Anjuta Plugin",
 												 "Name", &name);
 	anjuta_plugin_description_get_locale_string (desc, "Anjuta Plugin",
@@ -252,6 +258,9 @@ on_about_plugin_activate (GtkMenuItem *item, AnjutaPluginDescription *desc)
 		authors_v = g_strsplit(authors, ",", -1);
 	}
 	dialog = gtk_about_dialog_new();
+	gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(shell));
+	gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
+	
 	gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(dialog), name);
 	gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), VERSION);
 	if (license)
@@ -310,9 +319,11 @@ about_create_plugins_submenu (AnjutaShell *shell, GtkWidget *menuitem)
 			{
 				item = gtk_menu_item_new_with_label (label);
 				gtk_widget_show (item);
+
+				g_object_set_data (G_OBJECT (item), "plugin-desc", desc);
 				g_signal_connect (G_OBJECT (item), "activate",
 								  G_CALLBACK (on_about_plugin_activate),
-								  desc);
+								  shell);
 				gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item);
 				g_free (authors);
 				g_free (license);
diff --git a/src/about.h b/src/about.h
index 1d70c9d..8a425b5 100644
--- a/src/about.h
+++ b/src/about.h
@@ -23,7 +23,7 @@
 
 #include <libanjuta/anjuta-shell.h>
 
-GtkWidget *about_box_new (void);
+GtkWidget *about_box_new (GtkWindow *parent);
 void about_create_plugins_submenu (AnjutaShell *shell, GtkWidget *menuitem);
 
 #endif
diff --git a/src/action-callbacks.c b/src/action-callbacks.c
index e8a1c3b..2b5207f 100644
--- a/src/action-callbacks.c
+++ b/src/action-callbacks.c
@@ -175,9 +175,9 @@ on_url_faqs_activate (GtkAction * action, gpointer user_data)
 }
 
 void
-on_about_activate (GtkAction * action, gpointer user_data)
-{
-	GtkWidget *about_dlg = about_box_new ();
+on_about_activate (GtkAction * action, AnjutaApp *app)
+{	
+	GtkWidget *about_dlg = about_box_new (GTK_WINDOW (app));
 
 	g_signal_connect_swapped(about_dlg, "response",
 		G_CALLBACK(gtk_widget_destroy), about_dlg);
diff --git a/src/action-callbacks.h b/src/action-callbacks.h
index 6196027..f354a4e 100644
--- a/src/action-callbacks.h
+++ b/src/action-callbacks.h
@@ -39,6 +39,6 @@ void on_url_home_activate (GtkAction * action, gpointer user_data);
 void on_url_bugs_activate (GtkAction * action, gpointer user_data);
 void on_url_faqs_activate (GtkAction * action, gpointer user_data);
 void on_url_activate (GtkAction * action, gpointer url);
-void on_about_activate (GtkAction * action, gpointer user_data);
+void on_about_activate (GtkAction * action, AnjutaApp *app);
 
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]