[Goodies-commits] r1812 - in xfce4-notes-plugin/trunk: . panel-plugin

Mike Massonnet mmassonnet at xfce.org
Fri Jul 28 04:00:32 CEST 2006


Author: mmassonnet
Date: 2006-07-28 02:00:30 +0000 (Fri, 28 Jul 2006)
New Revision: 1812

Modified:
   xfce4-notes-plugin/trunk/ChangeLog
   xfce4-notes-plugin/trunk/README
   xfce4-notes-plugin/trunk/panel-plugin/notes-window.c
Log:
Ask for confirmation on note delete.  Set policy automatic for the vertical scrollbar.

Modified: xfce4-notes-plugin/trunk/ChangeLog
===================================================================
--- xfce4-notes-plugin/trunk/ChangeLog	2006-07-28 01:32:51 UTC (rev 1811)
+++ xfce4-notes-plugin/trunk/ChangeLog	2006-07-28 02:00:30 UTC (rev 1812)
@@ -1,3 +1,6 @@
++ 2006/07/27    mmassonnet
+    - Set vertical scrollbar policy by default to automatic
+	- Add a confirmation dialog on note delete
 + 2006/07/24    mmassonnet
     - Fix a bug with the window size
 + 2006/07/24	mmassonnet

Modified: xfce4-notes-plugin/trunk/README
===================================================================
--- xfce4-notes-plugin/trunk/README	2006-07-28 01:32:51 UTC (rev 1811)
+++ xfce4-notes-plugin/trunk/README	2006-07-28 02:00:30 UTC (rev 1812)
@@ -10,15 +10,15 @@
     - http://goodies.xfce.org/projects/panel-plugins/xfce4-notes-plugin
 
 INSTALL:
-	tar xf xfce4-notes-plugin-<version-number>.tar.gz
-	./configure
-	make
-	make install
+    tar xf xfce4-notes-plugin-<version-number>.tar.gz
+    ./configure
+    make
+    make install
 
     See the file INSTALL for more instructions.
 
 QUESTIONS:
-	Send an e-mail to <mmassonnet at gmail.com>
+    Send an e-mail to <mmassonnet at gmail.com>
     You can also join the Xfce goodies mailing-list:
         - http://foo-projects.org/mailman/listinfo/goodies-dev
 

Modified: xfce4-notes-plugin/trunk/panel-plugin/notes-window.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/notes-window.c	2006-07-28 01:32:51 UTC (rev 1811)
+++ xfce4-notes-plugin/trunk/panel-plugin/notes-window.c	2006-07-28 02:00:30 UTC (rev 1812)
@@ -42,8 +42,10 @@
 static void     on_note_changed (GtkWidget *, NotesPlugin *);
 static void     on_page_create (GtkWidget *, NotesPlugin *);
 static gboolean on_page_delete (GtkWidget *, GdkEventButton *, NotesPlugin *);
+static void     note_page_destroy (GtkWidget *, gint response_id,
+                                   NotesPlugin *);
+static void     note_page_free (NotePage *);
 
-
 Note *
 note_new (NotesPlugin *notes)
 {
@@ -203,10 +205,10 @@
     page->scroll = gtk_scrolled_window_new (NULL, NULL);
     gtk_widget_show (page->scroll);
 
-    //GtkPolicyType vpolicy = (notes->options.vscrollbar) ? GTK_POLICY_ALWAYS 
+    //GtkPolicyType vpolicy = (notes->options.vscrollbar) ? GTK_POLICY_ALWAYS
     //                        : GTK_POLICY_AUTOMATIC;
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (page->scroll),
-                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
     /* Text view */
     page->text = gtk_text_view_new ();
@@ -352,7 +354,31 @@
 {
     if (event->type == GDK_BUTTON_RELEASE && event->button == 1)
       {
-        gint id;
+      	/* Ask for confirmation */
+      	GtkWidget *dialog;
+      	dialog =
+      	    gtk_message_dialog_new (GTK_WINDOW (notes->note->window),
+      	                            GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+      	                            GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+      	                            _("Are you sure you want to delete this note?"));
+
+      	g_signal_connect (dialog, "response", G_CALLBACK (note_page_destroy),
+      	                  notes);
+
+        gtk_widget_show (dialog);
+      }
+
+    return TRUE;
+}
+
+static void
+note_page_destroy (GtkWidget *widget, gint response_id, NotesPlugin *notes)
+{
+    gtk_widget_destroy (widget);
+
+    if (response_id == GTK_RESPONSE_YES)
+      {
+      	gint id;
         GtkNotebook *notebook;
         GList *pages;
         NotePage *page;
@@ -363,15 +389,15 @@
 
         DBG ("Delete id %d", id);
 
+        gtk_notebook_remove_page (notebook, id);
+
         notes->note->pages = g_list_nth (notes->note->pages, 0);
         pages = g_list_nth (notes->note->pages, id);
 
         notes->note->pages = g_list_remove_link (notes->note->pages, pages);
         g_list_free_1 (pages);
-        gtk_notebook_remove_page (notebook, id);
 
         pages = g_list_nth (notes->note->pages, 0);
-
         for (id = 0, page = (NotePage *)g_list_nth_data (pages, id);
              page != NULL;
              id++, page = (NotePage *)g_list_nth_data (pages, id))
@@ -389,7 +415,7 @@
         XfceRc *rc;
 
         if (!(file = xfce_panel_plugin_save_location (notes->plugin, TRUE)))
-            return TRUE;
+            return;
 
         rc = xfce_rc_simple_open (file, FALSE);
         g_free (file);
@@ -406,7 +432,4 @@
 
         save_on_timeout (notes);
       }
-
-    return TRUE;
 }
-




More information about the Goodies-commits mailing list