[Goodies-commits] r3222 - in xfce4-places-plugin/trunk: . panel-plugin
Diego Ongaro
ongardie at xfce.org
Thu Sep 13 01:22:37 CEST 2007
Author: ongardie
Date: 2007-09-12 23:22:37 +0000 (Wed, 12 Sep 2007)
New Revision: 3222
Modified:
xfce4-places-plugin/trunk/ChangeLog
xfce4-places-plugin/trunk/panel-plugin/cfg.c
Log:
2007-09-12 Diego Ongaro <ongardie at gmail.com>
* cfg.c: Fix: couldn't open menu with the search cmd field focused
Modified: xfce4-places-plugin/trunk/ChangeLog
===================================================================
--- xfce4-places-plugin/trunk/ChangeLog 2007-09-12 23:03:17 UTC (rev 3221)
+++ xfce4-places-plugin/trunk/ChangeLog 2007-09-12 23:22:37 UTC (rev 3222)
@@ -3,6 +3,7 @@
* cfg.h: Don't define recent documents settings if compiled w/o.
* cfg.{c,h}: Clean-up, added more assertions
* view.{c,h}: Clean-up. Improved sizing algorithm.
+ * cfg.c: Fix: couldn't open menu with the search cmd field focused
2007-09-11 Diego Ongaro <ongardie at gmail.com>
Modified: xfce4-places-plugin/trunk/panel-plugin/cfg.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/cfg.c 2007-09-12 23:03:17 UTC (rev 3221)
+++ xfce4-places-plugin/trunk/panel-plugin/cfg.c 2007-09-12 23:22:37 UTC (rev 3222)
@@ -210,22 +210,34 @@
pcfg_button_label_cb(GtkWidget *label_entry, GdkEventFocus *event, PlacesCfg *cfg)
{
const gchar *entry_text;
+ gchar *old_text = cfg->label;
+ gchar *new_text;
g_assert(cfg != NULL);
- if(cfg->label != NULL)
- g_free(cfg->label);
+ entry_text = gtk_entry_get_text(GTK_ENTRY(label_entry));
+ new_text = g_strstrip(g_strdup(entry_text));
+ if(old_text == NULL || (strcmp(old_text, new_text) && strlen(new_text))){
+ cfg->label = new_text;
+
+ if(old_text != NULL)
+ g_free(old_text);
- entry_text = gtk_entry_get_text(GTK_ENTRY(label_entry));
- cfg->label = g_strstrip(g_strdup(entry_text));
- if(strlen(cfg->label) == 0){
- g_free(cfg->label);
- cfg->label = g_strdup(_("Places"));
- gtk_entry_set_text(GTK_ENTRY(label_entry), cfg->label);
+ places_view_cfg_iface_update_button(cfg->view_iface);
+
+ }else{ /* we prefer the old/default text */
+
+ if(old_text == NULL)
+ cfg->label = g_strdup(_("Places"));
+
+ if(old_text == NULL || !strlen(new_text)){
+ gtk_entry_set_text(GTK_ENTRY(label_entry), cfg->label);
+ places_view_cfg_iface_update_button(cfg->view_iface);
+ }
+
+ g_free(new_text);
}
- places_view_cfg_iface_update_button(cfg->view_iface);
-
return FALSE;
}
@@ -233,18 +245,25 @@
pcfg_search_cmd_cb(GtkWidget *label_entry, GdkEventFocus *event, PlacesCfg *cfg)
{
const gchar *entry_text;
+ gchar *old_text = cfg->search_cmd;
+ gchar *new_text;
g_assert(cfg != NULL);
- if(cfg->search_cmd != NULL)
- g_free(cfg->search_cmd);
-
entry_text = gtk_entry_get_text(GTK_ENTRY(label_entry));
- cfg->search_cmd = g_strstrip(g_strdup(entry_text));
+ new_text = g_strstrip(g_strdup(entry_text));
- /* TODO: you can't open menu when the field is focused */
- places_view_cfg_iface_update_menu(cfg->view_iface);
+ if(old_text == NULL || strcmp(old_text, new_text)){
+ cfg->search_cmd = new_text;
+
+ if(old_text != NULL)
+ g_free(old_text);
+
+ places_view_cfg_iface_update_menu(cfg->view_iface);
+ }else /* we prefer the old text */
+ g_free(new_text);
+
return FALSE;
}
More information about the Goodies-commits
mailing list