[Goodies-commits] r1931 - in xfce4-notes-plugin/trunk: . panel-plugin
Mike Massonnet
mmassonnet at xfce.org
Wed Aug 30 04:44:27 CEST 2006
Author: mmassonnet
Date: 2006-08-30 02:44:24 +0000 (Wed, 30 Aug 2006)
New Revision: 1931
Modified:
xfce4-notes-plugin/trunk/ChangeLog
xfce4-notes-plugin/trunk/TODO
xfce4-notes-plugin/trunk/panel-plugin/notes-options.c
xfce4-notes-plugin/trunk/panel-plugin/notes-window.c
xfce4-notes-plugin/trunk/panel-plugin/notes.c
xfce4-notes-plugin/trunk/panel-plugin/notes.h
Log:
* panel-plugin/notes.c: Use rc groups.
* panel-plugin/notes-window.c: Revert the question if only the tab is
edited. Use a save-timeout when a page is closed.
* panel-plugin/notes.{c,h}, panel-plugin/notes-options.c: Still remove
deprecated code.
* panel-plugin/notes.c, panel-plugin/notes-window.c: Clean up
save_on_timeout() and make better use of it (on close a page). Add
save_on_timeout_execute().
Modified: xfce4-notes-plugin/trunk/ChangeLog
===================================================================
--- xfce4-notes-plugin/trunk/ChangeLog 2006-08-29 07:14:03 UTC (rev 1930)
+++ xfce4-notes-plugin/trunk/ChangeLog 2006-08-30 02:44:24 UTC (rev 1931)
@@ -1,3 +1,14 @@
+2006-08-30 Mike Massonnet <mmassonnet at gmail.com>
+
+ * panel-plugin/notes.c: Use rc groups.
+ * panel-plugin/notes-window.c: Revert the question if only the tab is
+ edited. Use a save-timeout when a page is closed.
+ * panel-plugin/notes.{c,h}, panel-plugin/notes-options.c: Still remove
+ deprecated code.
+ * panel-plugin/notes.c, panel-plugin/notes-window.c: Clean up
+ save_on_timeout() and make better use of it (on close a page). Add
+ save_on_timeout_execute().
+
2006-08-14 Mike Massonnet <mmassonnet at gmail.com>
* panel-plugin/notes-window.c:
Modified: xfce4-notes-plugin/trunk/TODO
===================================================================
--- xfce4-notes-plugin/trunk/TODO 2006-08-29 07:14:03 UTC (rev 1930)
+++ xfce4-notes-plugin/trunk/TODO 2006-08-30 02:44:24 UTC (rev 1931)
@@ -1,2 +1,3 @@
* HypertextView for hyperlinks
* Type-ahead style search
+* Lock a note with a toggle button
Modified: xfce4-notes-plugin/trunk/panel-plugin/notes-options.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/notes-options.c 2006-08-29 07:14:03 UTC (rev 1930)
+++ xfce4-notes-plugin/trunk/panel-plugin/notes-options.c 2006-08-30 02:44:24 UTC (rev 1931)
@@ -46,7 +46,6 @@
{
GtkWidget *dialog, *vbox;
GtkWidget *cb_show, *cb_task_switcher, *cb_always_on_top, *cb_stick;
- GtkWidget *hseparator;
NotesOptions *options;
DBG ("New Notes Options");
Modified: xfce4-notes-plugin/trunk/panel-plugin/notes-window.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/notes-window.c 2006-08-29 07:14:03 UTC (rev 1930)
+++ xfce4-notes-plugin/trunk/panel-plugin/notes-window.c 2006-08-30 02:44:24 UTC (rev 1931)
@@ -114,7 +114,7 @@
gtk_container_add (GTK_CONTAINER (note->add), image_add);
- gtk_widget_add_accelerator (note->add, "clicked", accel_group, 'N',
+ gtk_widget_add_accelerator (note->add, "clicked", accel_group, 'N',
GDK_CONTROL_MASK, GTK_ACCEL_MASK);
g_signal_connect (note->add, "clicked", G_CALLBACK (on_page_create), notes);
@@ -132,7 +132,7 @@
gtk_container_add (GTK_CONTAINER (note->del), image_del);
- gtk_widget_add_accelerator (note->del, "clicked", accel_group, 'W',
+ gtk_widget_add_accelerator (note->del, "clicked", accel_group, 'W',
GDK_CONTROL_MASK, GTK_ACCEL_MASK);
g_signal_connect (note->del, "clicked", G_CALLBACK (on_page_delete), notes);
@@ -375,14 +375,7 @@
static void
on_note_changed (GtkWidget *widget, NotesPlugin *notes)
{
- if (notes->timeout_id > 0)
- {
- g_source_remove (notes->timeout_id);
- notes->timeout_id = 0;
- }
-
- notes->timeout_id = g_timeout_add (60000, (GSourceFunc) save_on_timeout,
- notes);
+ save_on_timeout (notes);
}
static void
@@ -426,10 +419,10 @@
slist = g_slist_append (slist, entry);
slist = g_slist_append (slist, page);
- g_signal_connect (dialog, "response",G_CALLBACK (on_note_rename_response),
+ g_signal_connect (dialog, "response",G_CALLBACK (on_note_rename_response),
slist);
- gtk_widget_show (dialog);
+ gtk_widget_show (dialog);
}
static gboolean
@@ -451,14 +444,14 @@
if (response == GTK_RESPONSE_OK)
{
- entry = GTK_WIDGET (g_slist_nth_data (slist, 0));
- page = (NotePage *) g_slist_nth_data (slist, 1);
+ entry = GTK_WIDGET (g_slist_nth_data (slist, 0));
+ page = (NotePage *) g_slist_nth_data (slist, 1);
- DBG ("Rename to: %s", gtk_entry_get_text (GTK_ENTRY (entry)));
+ DBG ("Rename to: %s", gtk_entry_get_text (GTK_ENTRY (entry)));
- page->label_dirty = TRUE;
- gtk_label_set_text (GTK_LABEL (page->label),
- gtk_entry_get_text (GTK_ENTRY (entry)));
+ page->label_dirty = TRUE;
+ gtk_label_set_text (GTK_LABEL (page->label),
+ gtk_entry_get_text (GTK_ENTRY (entry)));
gtk_label_set_angle (GTK_LABEL (page->label), 90);
}
@@ -484,7 +477,7 @@
page = (NotePage *)g_list_nth_data (notes->note->pages, id);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (page->text));
- if (gtk_text_buffer_get_char_count (buffer) > 0 || page->label_dirty)
+ if (gtk_text_buffer_get_char_count (buffer) > 0)
{
/* Ask for confirmation */
GtkWidget *dialog;
@@ -507,21 +500,21 @@
static void
note_page_destroy (GtkWidget *widget, gint response_id, NotesPlugin *notes)
{
+ gchar *file;
+ XfceRc *rc;
+ gint id;
+ GtkNotebook *notebook;
+ GList *pages;
+ NotePage *page;
+ GtkTextBuffer *buffer;
+ gchar tab_label[8];
+ gchar note_entry[12], label_entry[13];
+
if (GTK_IS_WIDGET (widget))
gtk_widget_destroy (widget);
if (response_id == GTK_RESPONSE_YES)
{
- gchar *file;
- XfceRc *rc;
- gint id;
- GtkNotebook *notebook;
- GList *pages;
- NotePage *page;
- GtkTextBuffer *buffer;
- gchar tab_label[8];
- gchar note_entry[12], label_entry[13];
-
notebook = GTK_NOTEBOOK (notes->note->notebook);
id = gtk_notebook_get_current_page (notebook);
Modified: xfce4-notes-plugin/trunk/panel-plugin/notes.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/notes.c 2006-08-29 07:14:03 UTC (rev 1930)
+++ xfce4-notes-plugin/trunk/panel-plugin/notes.c 2006-08-30 02:44:24 UTC (rev 1931)
@@ -39,6 +39,7 @@
static void notes_construct (XfcePanelPlugin *);
static void notes_free_data (XfcePanelPlugin *, NotesPlugin *);
static void notes_save (XfcePanelPlugin *, NotesPlugin *);
+static gboolean save_on_timeout_execute (NotesPlugin *);
static void notes_configure (XfcePanelPlugin *, NotesPlugin *);
static gboolean notes_set_size (XfcePanelPlugin *, int size, NotesPlugin *);
static void notes_load_data (XfcePanelPlugin *, NotesPlugin *);
@@ -70,6 +71,14 @@
{
char *file;
XfceRc *rc;
+ gint id;
+ NotePage *page;
+ GList *pages;
+ GtkTextBuffer *buffer;
+ GtkTextIter start, end;
+ gchar *text;
+ const gchar *label;
+ gchar note_entry[12], label_entry[13];
DBG ("Save: %s", PLUGIN_NAME);
@@ -93,6 +102,8 @@
¬es->note->w, NULL);
}
+ xfce_rc_set_group (rc, "settings");
+
xfce_rc_write_int_entry (rc, "pos_x", notes->note->x);
xfce_rc_write_int_entry (rc, "pos_y", notes->note->y);
xfce_rc_write_int_entry (rc, "width", notes->note->w);
@@ -104,19 +115,9 @@
xfce_rc_write_bool_entry (rc, "always_on_top",
notes->options.always_on_top);
xfce_rc_write_bool_entry (rc, "stick", notes->options.stick);
- xfce_rc_write_bool_entry (rc, "vscrollbar", notes->options.vscrollbar);
-
- gint id;
- NotePage *page;
- GList *pages;
- GtkTextBuffer *buffer;
- GtkTextIter start, end;
- gchar *text;
- const gchar *label;
- gchar note_entry[12], label_entry[13];
-
pages = notes->note->pages;
+ xfce_rc_set_group (rc, "notes");
for (id = 0, page = (NotePage *)g_list_nth_data (pages, id);
page != NULL;
@@ -138,25 +139,37 @@
text = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (buffer), &start,
&end, TRUE);
+ DBG ("Note %d (%s): %s", id, note_entry, text);
xfce_rc_write_entry (rc, note_entry, text);
g_free (text);
-
- DBG ("Note %d (%s): %s", id, note_entry, text);
}
-
xfce_rc_close (rc);
}
}
-gboolean
-save_on_timeout (NotesPlugin *notes)
+static gboolean
+save_on_timeout_execute (NotesPlugin *notes)
{
notes_save (notes->plugin, notes);
return FALSE;
}
+void
+save_on_timeout (NotesPlugin *notes)
+{
+ if (notes->timeout_id > 0)
+ {
+ g_source_remove (notes->timeout_id);
+ notes->timeout_id = 0;
+ }
+
+ notes->timeout_id = g_timeout_add (60000,
+ (GSourceFunc) save_on_timeout_execute,
+ notes);
+}
+
static void
notes_configure (XfcePanelPlugin *plugin, NotesPlugin *notes)
{
@@ -282,6 +295,7 @@
{
id = 0;
g_snprintf (note_entry, 12, "note%d", id++);
+ xfce_rc_set_group (rc, "notes");
while (xfce_rc_has_entry (rc, note_entry))
{
note_page_new (plugin, notes);
@@ -290,6 +304,8 @@
if (id == 1 && !xfce_rc_has_entry (rc, note_entry))
note_page_new (plugin, notes);
+ xfce_rc_set_group (rc, "settings");
+
notes->note->x = xfce_rc_read_int_entry (rc, "pos_x", -1);
notes->note->y = xfce_rc_read_int_entry (rc, "pos_y", -1);
notes->note->w = xfce_rc_read_int_entry (rc, "width", 242);
@@ -301,8 +317,6 @@
notes->options.always_on_top =
xfce_rc_read_bool_entry (rc, "always_on_top", FALSE);
notes->options.stick = xfce_rc_read_bool_entry (rc, "stick", TRUE);
- notes->options.vscrollbar =
- xfce_rc_read_bool_entry (rc, "vscrollbar", TRUE);
xfce_rc_close (rc);
}
Modified: xfce4-notes-plugin/trunk/panel-plugin/notes.h
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/notes.h 2006-08-29 07:14:03 UTC (rev 1930)
+++ xfce4-notes-plugin/trunk/panel-plugin/notes.h 2006-08-30 02:44:24 UTC (rev 1931)
@@ -30,7 +30,6 @@
gboolean task_switcher;
gboolean always_on_top;
gboolean stick;
- gboolean vscrollbar;
}
NotesOptions;
@@ -52,6 +51,6 @@
NotesPlugin * notes_new (XfcePanelPlugin *);
Note * note_new (NotesPlugin *);
void note_page_new (XfcePanelPlugin *, NotesPlugin *);
-gboolean save_on_timeout (NotesPlugin *);
+void save_on_timeout (NotesPlugin *);
#endif
More information about the Goodies-commits
mailing list