Don't use grep in sokoke_get_desktop and fix memory leaks

This commit is contained in:
Enrico Tröger 2008-11-29 00:16:57 +01:00 committed by Christian Dywan
parent 30572a2b73
commit 417493caa3
3 changed files with 10 additions and 10 deletions

View file

@ -59,14 +59,13 @@ proxy_combo_box_text_changed_cb (GtkComboBox* button, GObject* object)
return FALSE; return FALSE;
} }
static gboolean static void
proxy_entry_activate_cb (GtkEntry* entry, proxy_entry_activate_cb (GtkEntry* entry,
GObject* object) GObject* object)
{ {
const gchar* text = gtk_entry_get_text (entry); const gchar* text = gtk_entry_get_text (entry);
const gchar* property = g_object_get_data (G_OBJECT (entry), "property"); const gchar* property = g_object_get_data (G_OBJECT (entry), "property");
g_object_set (object, property, text, NULL); g_object_set (object, property, text, NULL);
return FALSE;
} }
static gboolean static gboolean
@ -99,13 +98,12 @@ proxy_spin_button_changed_cb (GtkSpinButton* button, GObject* object)
return FALSE; return FALSE;
} }
static gchar* static void
proxy_combo_box_changed_cb (GtkComboBox* button, GObject* object) proxy_combo_box_changed_cb (GtkComboBox* button, GObject* object)
{ {
gint value = gtk_combo_box_get_active (button); gint value = gtk_combo_box_get_active (button);
const gchar* property = g_object_get_data (G_OBJECT (button), "property"); const gchar* property = g_object_get_data (G_OBJECT (button), "property");
g_object_set (object, property, value, NULL); g_object_set (object, property, value, NULL);
return FALSE;
} }
/** /**

View file

@ -100,7 +100,7 @@ midori_preferences_init (MidoriPreferences* preferences)
g_signal_connect (preferences, "response", g_signal_connect (preferences, "response",
G_CALLBACK (midori_preferences_response_cb), NULL); G_CALLBACK (midori_preferences_response_cb), NULL);
/* TODO: Do we want tooltips for explainations or can we omit that? */ /* TODO: Do we want tooltips for explanations or can we omit that? */
g_free (dialog_title); g_free (dialog_title);
} }

View file

@ -212,14 +212,15 @@ sokoke_get_desktop (void)
if (G_UNLIKELY (desktop == SOKOKE_DESKTOP_UNTESTED)) if (G_UNLIKELY (desktop == SOKOKE_DESKTOP_UNTESTED))
{ {
/* Are we running in Xfce? */ /* Are we running in Xfce? */
gint result; gchar* out; gchar* err; gint result;
gboolean success = g_spawn_command_line_sync ( gchar *out = NULL;
"xprop -root _DT_SAVE_MODE | grep -q xfce4", gboolean success = g_spawn_command_line_sync ("xprop -root _DT_SAVE_MODE",
&out, &err, &result, NULL); &out, NULL, &result, NULL);
if (success && !result) if (success && ! result && out != NULL && strstr(out, "xfce4") != NULL)
desktop = SOKOKE_DESKTOP_XFCE; desktop = SOKOKE_DESKTOP_XFCE;
else else
desktop = SOKOKE_DESKTOP_UNKNOWN; desktop = SOKOKE_DESKTOP_UNKNOWN;
g_free(out);
} }
return desktop; return desktop;
@ -258,6 +259,7 @@ sokoke_xfce_header_new (const gchar* icon,
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (xfce_heading), hbox); gtk_container_add (GTK_CONTAINER (xfce_heading), hbox);
g_free (markup); g_free (markup);
gtk_widget_destroy(entry);
return xfce_heading; return xfce_heading;
} }
return NULL; return NULL;