[Goodies-commits] r6729 - in xfce4-notes-plugin/trunk: . panel-plugin
Mike Massonnet
mmassonnet at xfce.org
Sat Feb 21 00:52:18 CET 2009
Author: mmassonnet
Date: 2009-02-20 23:52:18 +0000 (Fri, 20 Feb 2009)
New Revision: 6729
Modified:
xfce4-notes-plugin/trunk/ChangeLog
xfce4-notes-plugin/trunk/panel-plugin/defines.h
xfce4-notes-plugin/trunk/panel-plugin/notes.c
xfce4-notes-plugin/trunk/panel-plugin/panel-plugin.c
xfce4-notes-plugin/trunk/panel-plugin/settings-dialog.c
Log:
Update the settings dialog
Modified: xfce4-notes-plugin/trunk/ChangeLog
===================================================================
--- xfce4-notes-plugin/trunk/ChangeLog 2009-02-20 19:36:13 UTC (rev 6728)
+++ xfce4-notes-plugin/trunk/ChangeLog 2009-02-20 23:52:18 UTC (rev 6729)
@@ -1,3 +1,15 @@
+2009-02-21 Mike Massonnet <mmassonnet at xfce.org>
+
+Update the settings dialog
+ * panel-plugin/settings-dialog.c:
+ - General clean up
+ - Add a "Show tabs" setting for new windows
+ - Replace the size width*height against a combobox with three
+ predefined sizes
+ - Rename title and subtitle
+ * panel-plugin/notes.c:
+ - Rename hide_tabs to show_tabs
+
2009-02-20 Mike Massonnet <mmassonnet at xfce.org>
Set default thickness for frame and add two mouse cursors for resizing
Modified: xfce4-notes-plugin/trunk/panel-plugin/defines.h
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/defines.h 2009-02-20 19:36:13 UTC (rev 6728)
+++ xfce4-notes-plugin/trunk/panel-plugin/defines.h 2009-02-20 23:52:18 UTC (rev 6729)
@@ -28,14 +28,18 @@
/* Default settings */
#define GENERAL_HIDE_FROM_TASKBAR TRUE
#define GENERAL_HIDE_ARROW_BUTTON FALSE
-#define NEW_WINDOW_WIDTH 375
-#define NEW_WINDOW_HEIGHT 430
#define NEW_WINDOW_ABOVE FALSE
#define NEW_WINDOW_STICKY TRUE
#define NEW_WINDOW_TABS TRUE
#define NEW_WINDOW_TRANSPARENCY 10
#define NEW_WINDOW_USE_FONT FALSE
#define NEW_WINDOW_FONT_DESCR "Sans 10"
+#define NEW_WINDOW_WIDTH SIZE_NORMAL
+#define NEW_WINDOW_HEIGHT ((gint)NEW_WINDOW_WIDTH*SIZE_FACTOR)
+#define SIZE_SMALL 240
+#define SIZE_NORMAL 305
+#define SIZE_LARGE 340
+#define SIZE_FACTOR 1.15
#endif
Modified: xfce4-notes-plugin/trunk/panel-plugin/notes.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/notes.c 2009-02-20 19:36:13 UTC (rev 6728)
+++ xfce4-notes-plugin/trunk/panel-plugin/notes.c 2009-02-20 23:52:18 UTC (rev 6729)
@@ -613,14 +613,15 @@
notes_window_set_transparency (notes_window, notes_window->transparency);
gtk_notebook_set_current_page (GTK_NOTEBOOK (notes_window->notebook), 0);
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notes_window->notebook), notes_window->show_tabs);
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notes_window->notebook),
+ (notes_window->show_tabs && g_slist_length (notes_window->notes) > 1));
gtk_notebook_set_show_border (GTK_NOTEBOOK (notes_window->notebook), FALSE);
}
void
notes_window_save_data (NotesWindow *notes_window)
{
- XfceRc *rc;
+ XfceRc *rc;
rc = xfce_rc_simple_open (notes_window->notes_plugin->config_file, FALSE);
g_return_if_fail (G_LIKELY (rc != NULL));
@@ -880,12 +881,12 @@
notes_window->menu_options = gtk_menu_new ();
GtkWidget *mi_above = gtk_check_menu_item_new_with_label (_("Always on top"));
GtkWidget *mi_sticky = gtk_check_menu_item_new_with_label (_("Sticky window"));
- GtkWidget *mi_hide_tabs = gtk_check_menu_item_new_with_label (_("Hide tabs"));
+ GtkWidget *mi_show_tabs = gtk_check_menu_item_new_with_label (_("Show tabs"));
GtkWidget *mi_show_on_startup = gtk_menu_item_new_with_label (_("Show on startup"));
gtk_menu_shell_append (GTK_MENU_SHELL (notes_window->menu_options), mi_above);
gtk_menu_shell_append (GTK_MENU_SHELL (notes_window->menu_options), mi_sticky);
- gtk_menu_shell_append (GTK_MENU_SHELL (notes_window->menu_options), mi_hide_tabs);
+ gtk_menu_shell_append (GTK_MENU_SHELL (notes_window->menu_options), mi_show_tabs);
gtk_menu_shell_append (GTK_MENU_SHELL (notes_window->menu_options), mi_show_on_startup);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (notes_window->mi_options), notes_window->menu_options);
@@ -906,13 +907,13 @@
/* Activate check menu items */
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi_sos_always),
- (notes_window->show_on_startup == ALWAYS));
+ notes_window->show_on_startup == ALWAYS);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi_sos_never),
- (notes_window->show_on_startup == NEVER));
+ notes_window->show_on_startup == NEVER);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi_sos_last_state),
- (notes_window->show_on_startup == LAST_STATE));
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi_hide_tabs),
- !notes_window->show_tabs);
+ notes_window->show_on_startup == LAST_STATE);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi_show_tabs),
+ notes_window->show_tabs);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi_above),
notes_window->above);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi_sticky),
@@ -923,7 +924,7 @@
/* Accel group */
gtk_menu_set_accel_group (GTK_MENU (notes_window->menu_options),
notes_window->accel_group);
- gtk_widget_add_accelerator (mi_hide_tabs,
+ gtk_widget_add_accelerator (mi_show_tabs,
"activate",
notes_window->accel_group,
GDK_F12,
@@ -944,7 +945,7 @@
"activate",
G_CALLBACK (notes_window_set_sos_last_state),
notes_window);
- g_signal_connect_swapped (mi_hide_tabs,
+ g_signal_connect_swapped (mi_show_tabs,
"activate",
G_CALLBACK (notes_window_set_tabs),
notes_window);
Modified: xfce4-notes-plugin/trunk/panel-plugin/panel-plugin.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/panel-plugin.c 2009-02-20 19:36:13 UTC (rev 6728)
+++ xfce4-notes-plugin/trunk/panel-plugin/panel-plugin.c 2009-02-20 23:52:18 UTC (rev 6729)
@@ -1,7 +1,7 @@
/*
* Notes - panel plugin for Xfce Desktop Environment
* Copyright (C) 2003 Jakob Henriksson <b0kaj+dev at lysator.liu.se>
- * Copyright (C) 2006-2008 Mike Massonnet <mmassonnet at xfce.org>
+ * Copyright (C) 2006-2009 Mike Massonnet <mmassonnet at xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -112,17 +112,23 @@
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+ /* Init the plugin */
notes_plugin = notes_plugin_new (panel_plugin);
+ gtk_widget_show_all (GTK_WIDGET (panel_plugin));
- /* Set initial orientation for the arrow */
- orientation = xfce_panel_plugin_get_orientation (panel_plugin);
- notes_plugin_set_orientation (notes_plugin, orientation);
-
#ifdef HAVE_XFCONF
notes_plugin_monitor_xfconf (notes_plugin);
#endif
- gtk_widget_show_all (GTK_WIDGET (panel_plugin));
+ /* Set the tooltip */
+#if GTK_CHECK_VERSION (2,12,0)
+ gtk_widget_set_tooltip_text (GTK_WIDGET (panel_plugin), _("Notes"));
+#endif
+
+ /* Set initial orientation of the arrow */
+ orientation = xfce_panel_plugin_get_orientation (panel_plugin);
+ notes_plugin_set_orientation (notes_plugin, orientation);
+
#ifdef HAVE_XFCONF
if (xfconf_channel_get_bool (notes_plugin->xfconf_channel,
"/general/hide_arrow_button",
@@ -130,12 +136,11 @@
gtk_widget_hide (notes_plugin->btn_arrow);
#endif
- /* TODO Postpone this call inside a idle function */
+ /* Load the notes */
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+
notes_plugin_load_data (notes_plugin);
-
-#if GTK_CHECK_VERSION (2,12,0)
- gtk_widget_set_tooltip_text (GTK_WIDGET (panel_plugin), _("Notes"));
-#endif
}
static NotesPlugin *
Modified: xfce4-notes-plugin/trunk/panel-plugin/settings-dialog.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/settings-dialog.c 2009-02-20 19:36:13 UTC (rev 6728)
+++ xfce4-notes-plugin/trunk/panel-plugin/settings-dialog.c 2009-02-20 23:52:18 UTC (rev 6729)
@@ -30,72 +30,41 @@
+static void cb_size_changed (GtkComboBox *button,
+ gpointer data);
+
static XfconfChannel *xfconf_channel = NULL;
GtkWidget *
prop_dialog_new (NotesPlugin *notes_plugin)
{
- GtkWidget *dialog, *frame, *box, *hbox, *button, *spin, *label;
- GtkWidget *size_box;
+ GtkWidget *dialog, *frame, *box, *hbox, *button, *label;
+ gint size;
/* Configuration channel */
if (NULL == xfconf_channel)
xfconf_channel = notes_plugin->xfconf_channel;
+#if 0
/* Set unset xfconf values */
- if (!xfconf_channel_has_property (xfconf_channel, "/general/hide_windows_from_taskbar"))
- xfconf_channel_set_bool (xfconf_channel,
- "/general/hide_windows_from_taskbar",
- GENERAL_HIDE_FROM_TASKBAR);
- if (!xfconf_channel_has_property (xfconf_channel, "/general/hide_arrow_button"))
- xfconf_channel_set_bool (xfconf_channel,
- "/general/hide_arrow_button",
- GENERAL_HIDE_ARROW_BUTTON);
- if (!xfconf_channel_has_property (xfconf_channel, "/new_window/width"))
- xfconf_channel_set_int (xfconf_channel,
- "/new_window/width",
- NEW_WINDOW_WIDTH);
- if (!xfconf_channel_has_property (xfconf_channel, "/new_window/height"))
- xfconf_channel_set_int (xfconf_channel,
- "/new_window/height",
- NEW_WINDOW_HEIGHT);
- if (!xfconf_channel_has_property (xfconf_channel, "/new_window/always_on_top"))
- xfconf_channel_set_bool (xfconf_channel,
- "/new_window/always_on_top",
- NEW_WINDOW_ABOVE);
- if (!xfconf_channel_has_property (xfconf_channel, "/new_window/sticky"))
- xfconf_channel_set_bool (xfconf_channel,
- "/new_window/sticky",
- NEW_WINDOW_STICKY);
- if (!xfconf_channel_has_property (xfconf_channel, "/new_window/show_tabs"))
- xfconf_channel_set_bool (xfconf_channel,
- "/new_window/show_tabs",
- NEW_WINDOW_TABS);
if (!xfconf_channel_has_property (xfconf_channel, "/new_window/transparency"))
xfconf_channel_set_int (xfconf_channel,
"/new_window/transparency",
NEW_WINDOW_TRANSPARENCY);
- if (!xfconf_channel_has_property (xfconf_channel, "/new_window/use_font"))
- xfconf_channel_set_bool (xfconf_channel,
- "/new_window/use_font",
- NEW_WINDOW_USE_FONT);
- if (!xfconf_channel_has_property (xfconf_channel, "/new_window/font_description"))
- xfconf_channel_set_string (xfconf_channel,
- "/new_window/font_description",
- NEW_WINDOW_FONT_DESCR);
+#endif
/* Dialog */
dialog =
- xfce_titled_dialog_new_with_buttons (_("Xfce 4 Notes Plugin"),
+ xfce_titled_dialog_new_with_buttons (_("Notes"),
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (notes_plugin->panel_plugin))),
GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_HELP, GTK_RESPONSE_HELP,
GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
NULL);
+ xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog), _("Configure the plugin"));
gtk_window_set_icon_name (GTK_WINDOW (dialog), "xfce4-notes-plugin");
gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE);
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
- gtk_window_set_default_size (GTK_WINDOW (dialog), 375, -1);
gtk_window_stick (GTK_WINDOW (dialog));
/* === Default settings === */
@@ -106,12 +75,14 @@
/* Hide from taskbar */
button = gtk_check_button_new_with_label (_("Hide windows from taskbar"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), GENERAL_HIDE_FROM_TASKBAR);
xfconf_g_property_bind (xfconf_channel, "/general/hide_windows_from_taskbar",
G_TYPE_BOOLEAN, G_OBJECT (button), "active");
gtk_container_add (GTK_CONTAINER (box), button);
/* Hide arrow button */
button = gtk_check_button_new_with_label (_("Hide arrow button"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), GENERAL_HIDE_ARROW_BUTTON);
xfconf_g_property_bind (xfconf_channel, "/general/hide_arrow_button",
G_TYPE_BOOLEAN, G_OBJECT (button), "active");
gtk_container_add (GTK_CONTAINER (box), button);
@@ -124,26 +95,36 @@
/* Always on top */
button = gtk_check_button_new_with_label (_("Always on top"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), NEW_WINDOW_ABOVE);
xfconf_g_property_bind (xfconf_channel, "/new_window/always_on_top",
G_TYPE_BOOLEAN, G_OBJECT (button), "active");
gtk_box_pack_start (GTK_BOX (box), button, TRUE, FALSE, 0);
/* Sticky window */
button = gtk_check_button_new_with_label (_("Sticky window"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), NEW_WINDOW_STICKY);
xfconf_g_property_bind (xfconf_channel, "/new_window/sticky",
G_TYPE_BOOLEAN, G_OBJECT (button), "active");
gtk_box_pack_start (GTK_BOX (box), button, TRUE, FALSE, 0);
+ /* Tabs */
+ button = gtk_check_button_new_with_label (_("Show tabs"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), NEW_WINDOW_TABS);
+ xfconf_g_property_bind (xfconf_channel, "/new_window/show_tabs",
+ G_TYPE_BOOLEAN, G_OBJECT (button), "active");
+ gtk_box_pack_start (GTK_BOX (box), button, TRUE, FALSE, 0);
+
/* Font */
hbox = gtk_hbox_new (FALSE, BORDER);
gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0);
- button = gtk_check_button_new_with_label (_("Font"));
+ button = gtk_check_button_new_with_label (_("Font:"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), NEW_WINDOW_USE_FONT);
xfconf_g_property_bind (xfconf_channel, "/new_window/use_font",
G_TYPE_BOOLEAN, G_OBJECT (button), "active");
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
- button = gtk_font_button_new ();
+ button = gtk_font_button_new_with_font (NEW_WINDOW_FONT_DESCR);
xfconf_g_property_bind (xfconf_channel, "/new_window/font_description",
G_TYPE_STRING, G_OBJECT (button), "font-name");
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
@@ -152,29 +133,62 @@
hbox = gtk_hbox_new (FALSE, BORDER);
gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0);
- label = gtk_label_new (_("Size"));
+ label = gtk_label_new (_("Size:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- size_box = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), size_box, TRUE, TRUE, 0);
+ button = gtk_combo_box_new_text ();
+ gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Small"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Normal"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Large"));
+ size = xfconf_channel_get_int (xfconf_channel, "/new_window/width", SIZE_NORMAL);
+ if (size == SIZE_SMALL)
+ gtk_combo_box_set_active (GTK_COMBO_BOX (button), 0);
+ else if (size == SIZE_NORMAL)
+ gtk_combo_box_set_active (GTK_COMBO_BOX (button), 1);
+ else if (size == SIZE_LARGE)
+ gtk_combo_box_set_active (GTK_COMBO_BOX (button), 2);
+ g_signal_connect (button, "changed", G_CALLBACK (cb_size_changed), NULL);
+ gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
- spin = gtk_spin_button_new_with_range (20.0, 600.0, 10.0);
- xfconf_g_property_bind (xfconf_channel, "/new_window/width",
- G_TYPE_INT, G_OBJECT (spin), "value");
- gtk_box_pack_start (GTK_BOX (size_box), spin, TRUE, TRUE, 0);
-
- label = gtk_label_new ("×");
- gtk_box_pack_start (GTK_BOX (size_box), label, FALSE, FALSE, BORDER);
-
- spin = gtk_spin_button_new_with_range (20.0, 600.0, 10.0);
- xfconf_g_property_bind (xfconf_channel, "/new_window/height",
- G_TYPE_INT, G_OBJECT (spin), "value");
- gtk_box_pack_start (GTK_BOX (size_box), spin, TRUE, TRUE, 0);
-
/* === Ending === */
gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
return dialog;
}
+
+static void
+cb_size_changed (GtkComboBox *button,
+ gpointer data)
+{
+ gint id;
+ gint width, height;
+
+ id = gtk_combo_box_get_active (button);
+
+ if (id < 0)
+ {
+ g_critical ("Trying to set a default size but got an active item < 0");
+ return;
+ }
+
+ if (id == 0)
+ {
+ width = SIZE_SMALL;
+ height = (gint)SIZE_SMALL*SIZE_FACTOR;
+ }
+ else if (id == 1)
+ {
+ width = SIZE_NORMAL;
+ height = (gint)SIZE_NORMAL*SIZE_FACTOR;
+ }
+ else if (id == 2)
+ {
+ width = SIZE_LARGE;
+ height = (gint)SIZE_LARGE*SIZE_FACTOR;
+ }
+
+ xfconf_channel_set_int (xfconf_channel, "/new_window/width", width);
+ xfconf_channel_set_int (xfconf_channel, "/new_window/height", height);
+}
#endif
More information about the Goodies-commits
mailing list