SF.net SVN: geany: [738] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Fri Aug 18 17:24:49 UTC 2006


Revision: 738
Author:   ntrel
Date:     2006-08-18 10:24:44 -0700 (Fri, 18 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=738&view=rev

Log Message:
-----------
Use Reload button for reload dialog; Share on_reload_as_activate code for reloading

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-08-18 17:23:40 UTC (rev 737)
+++ trunk/ChangeLog	2006-08-18 17:24:44 UTC (rev 738)
@@ -3,6 +3,12 @@
  * src/keyfile.c: Fix a small memory leak in configuration_load.
  * src/dialogs.c: Change Don't save button icon and add mnemonic.
  * src/main.c: Fix building on win32 - thanks to Củ Văn Chuối.
+ * src/dialogs.c, src/dialogs.h:
+   Add dialogs_show_question_full for custom buttons and extra text.
+   Don't show message dialogs in the window manager taskbar.
+ * src/utils.c: Use Reload button for utils_check_disk_status dialog.
+ * src/callbacks.c: Use Reload button for reload dialog.
+                    Share on_reload_as_activate code for reloading.
 
 
 2006-08-17  Nick Treleaven  <nick.treleaven at btinternet.com>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2006-08-18 17:23:40 UTC (rev 737)
+++ trunk/src/callbacks.c	2006-08-18 17:24:44 UTC (rev 738)
@@ -196,8 +196,9 @@
 		{
 			if (app->pref_main_confirm_exit)
 			{
-				if (dialogs_show_question(_("Do you really want to quit?")) &&
-					on_close_all1_activate(NULL, NULL)) destroyapp(NULL, gdata);
+				if (dialogs_show_question_full(GTK_STOCK_QUIT, GTK_STOCK_CANCEL, NULL,
+					_("Do you really want to quit?")) && on_close_all1_activate(NULL, NULL))
+						destroyapp(NULL, gdata);
 				else app->quitting = FALSE;
 			}
 			else
@@ -211,7 +212,9 @@
 	{
 		if (app->pref_main_confirm_exit)
 		{
-			if (dialogs_show_question(_("Do you really want to quit?"))) destroyapp(NULL, gdata);
+			if (dialogs_show_question(GTK_STOCK_QUIT, GTK_STOCK_CANCEL, NULL,
+				_("Do you really want to quit?")))
+					destroyapp(NULL, gdata);
 			else app->quitting = FALSE;
 		}
 		else
@@ -489,19 +492,37 @@
 on_toolbutton23_clicked                (GtkToolButton   *toolbutton,
                                         gpointer         user_data)
 {
+	on_reload_as_activate(NULL, GINT_TO_POINTER(-1));
+}
+
+
+// also used for reloading when user_data is -1
+void
+on_reload_as_activate                  (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
 	gint idx = document_get_cur_idx();
 	gchar *basename;
+	gint i = GPOINTER_TO_INT(user_data);
+	gchar *charset = NULL;
 
-	if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_name == NULL) return;
+	if (idx < 0 || ! doc_list[idx].is_valid || doc_list[idx].file_name == NULL)
+		return;
+	if (i >= 0)
+	{
+		if (i >= GEANY_ENCODINGS_MAX || encodings[i].charset == NULL) return;
+		charset = encodings[i].charset;
+	}
 
 	basename = g_path_get_basename(doc_list[idx].file_name);
-	if (dialogs_show_question(_
-				 ("Are you sure you want to reload '%s'?\nAny unsaved changes will be lost."),
-				 basename))
+	if (dialogs_show_question_full(_("_Reload"), GTK_STOCK_CANCEL,
+		_("Any unsaved changes will be lost."),
+		_("Are you sure you want to reload '%s'?"), basename))
 	{
-		document_reload_file(idx, NULL);
+		document_reload_file(idx, charset);
+		if (charset != NULL)
+			utils_update_statusbar(idx, -1);
 	}
-
 	g_free(basename);
 }
 
@@ -2347,29 +2368,6 @@
 
 
 void
-on_reload_as_activate                  (GtkMenuItem     *menuitem,
-                                        gpointer         user_data)
-{
-	gint idx = document_get_cur_idx();
-	gchar *basename;
-	gint i = GPOINTER_TO_INT(user_data);
-
-	if (idx < 0 || ! doc_list[idx].is_valid || doc_list[idx].file_name == NULL ||
-		i < 0 || i >= GEANY_ENCODINGS_MAX || encodings[i].charset == NULL)
-		return;
-
-	basename = g_path_get_basename(doc_list[idx].file_name);
-	if (dialogs_show_question(_
-				 ("Are you sure you want to reload '%s'?\nAny unsaved changes will be lost."),
-				 basename))
-	{
-		document_reload_file(idx, encodings[i].charset);
-		utils_update_statusbar(idx, -1);
-	}
-	g_free(basename);
-}
-
-void
 on_print1_activate                     (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list