gnome-control-center r8761 - in branches/randr-12: . capplets/about-me capplets/accessibility/at-properties capplets/appearance capplets/common capplets/default-applications capplets/default-applications/icons capplets/display capplets/keybindings capplets/keyboard capplets/localization capplets/mouse capplets/network capplets/sound capplets/windows help libwindow-settings po shell typing-break vfs-methods vfs-methods/fontilus vfs-methods/themus
- From: ssp svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-control-center r8761 - in branches/randr-12: . capplets/about-me capplets/accessibility/at-properties capplets/appearance capplets/common capplets/default-applications capplets/default-applications/icons capplets/display capplets/keybindings capplets/keyboard capplets/localization capplets/mouse capplets/network capplets/sound capplets/windows help libwindow-settings po shell typing-break vfs-methods vfs-methods/fontilus vfs-methods/themus
- Date: Tue, 17 Jun 2008 23:18:22 +0000 (UTC)
Author: ssp
Date: Tue Jun 17 23:18:22 2008
New Revision: 8761
URL: http://svn.gnome.org/viewvc/gnome-control-center?rev=8761&view=rev
Log:
Merge from trunk
Added:
branches/randr-12/capplets/default-applications/icons/
- copied from r8760, /trunk/capplets/default-applications/icons/
Removed:
branches/randr-12/capplets/common/bonobo-property-editor-range.c
branches/randr-12/capplets/common/bonobo-property-editor-range.h
Modified:
branches/randr-12/ChangeLog
branches/randr-12/Makefile.am
branches/randr-12/NEWS
branches/randr-12/capplets/about-me/ChangeLog
branches/randr-12/capplets/accessibility/at-properties/ChangeLog
branches/randr-12/capplets/appearance/ChangeLog
branches/randr-12/capplets/appearance/appearance-desktop.c
branches/randr-12/capplets/appearance/appearance-main.c
branches/randr-12/capplets/appearance/gnome-wp-info.c
branches/randr-12/capplets/appearance/gnome-wp-item.c
branches/randr-12/capplets/appearance/theme-installer.c
branches/randr-12/capplets/appearance/theme-util.c
branches/randr-12/capplets/appearance/theme-util.h
branches/randr-12/capplets/common/ChangeLog
branches/randr-12/capplets/common/Makefile.am
branches/randr-12/capplets/common/capplet-util.c
branches/randr-12/capplets/common/capplet-util.h
branches/randr-12/capplets/common/gconf-property-editor.c
branches/randr-12/capplets/common/gnome-theme-info.c
branches/randr-12/capplets/default-applications/ChangeLog
branches/randr-12/capplets/default-applications/Makefile.am
branches/randr-12/capplets/default-applications/gnome-da-capplet.c
branches/randr-12/capplets/display/ChangeLog
branches/randr-12/capplets/keybindings/ChangeLog
branches/randr-12/capplets/keybindings/gnome-keybinding-properties.c
branches/randr-12/capplets/keyboard/ChangeLog
branches/randr-12/capplets/localization/ChangeLog
branches/randr-12/capplets/mouse/ChangeLog
branches/randr-12/capplets/network/ChangeLog
branches/randr-12/capplets/network/gnome-network-preferences.c
branches/randr-12/capplets/sound/ChangeLog
branches/randr-12/capplets/windows/ChangeLog
branches/randr-12/configure.in
branches/randr-12/help/ChangeLog
branches/randr-12/libwindow-settings/ChangeLog
branches/randr-12/po/ChangeLog
branches/randr-12/po/POTFILES.in
branches/randr-12/po/POTFILES.skip
branches/randr-12/po/ar.po
branches/randr-12/po/es.po
branches/randr-12/po/gl.po
branches/randr-12/po/hu.po
branches/randr-12/po/nb.po
branches/randr-12/po/th.po
branches/randr-12/po/vi.po
branches/randr-12/po/zh_CN.po
branches/randr-12/shell/ChangeLog
branches/randr-12/typing-break/ChangeLog
branches/randr-12/typing-break/drwright.c
branches/randr-12/vfs-methods/Makefile.am
branches/randr-12/vfs-methods/fontilus/ChangeLog
branches/randr-12/vfs-methods/themus/ChangeLog
Modified: branches/randr-12/Makefile.am
==============================================================================
--- branches/randr-12/Makefile.am (original)
+++ branches/randr-12/Makefile.am Tue Jun 17 23:18:22 2008
@@ -1,4 +1,4 @@
-SUBDIRS = po libsounds libbackground libwindow-settings libslab capplets shell help vfs-methods $(TYPING_BREAK)
+SUBDIRS = po libsounds libwindow-settings libslab capplets shell help vfs-methods $(TYPING_BREAK)
ACLOCAL_AMFLAGS = -I m4
Modified: branches/randr-12/NEWS
==============================================================================
--- branches/randr-12/NEWS (original)
+++ branches/randr-12/NEWS Tue Jun 17 23:18:22 2008
@@ -1,3 +1,98 @@
+gnome-control-center 2.23.4 (2008-06-16)
+
+default applications:
+- Convert to use GConfPropertyEditor and remove a lot of duplicated code in
+ the process (Thomas Wood)
+- Provide a Tango style application icon (Jakub Steiner, Thomas Wood) (#397312)
+
+typing break:
+- When postponing a voluntary break, go back to the state before taking the
+ break instead of going to warn state (Andrey Gusev) (#134595)
+
+general:
+- Increased gnome-desktop requirement (Rodrigo Moya)
+
+updated translations:
+- ar (Djihed Afifi)
+- es (Jorge Gonzalez)
+- hu (Gabor Kelemen)
+- nb (Kjartan Maraas)
+- th (Theppitak Karoonboonyanan)
+- zh_CN (Funda Wang)
+------------------------------------------------------------------------------
+gnome-control-center 2.23.3 (2008-06-04)
+
+appearance:
+- Remove the last traces of gnome-vfs (Lincoln de Sousa) (#524401)
+- Fix theme deletion (Jens Granseuer)
+- Update to match API changes in gnome-desktop (Soeren Sandmann)
+- Fix "zoom" mode (Soeren Sandmann)
+- Use URIs instead of paths for drag and drop (Soeren Sandmann)
+- Delay creation of the wallaper file chooser for increased startup
+ performance (Thomas Wood)
+
+default-applications:
+- Major refactoring to use GConfPropertyEditor and reduce code duplication
+ (Thomas Wood)
+
+keybindings:
+- Don't use deprecated GTK+ symbol (William Jon McCann)
+- Add support for editing custom keybindings (create/delete not yet
+ implemented) (Jens Granseuer)
+
+general:
+- Remove themus vfs-method (Thomas Wood)
+- Minor cleanup in capplet-util and gconf-property-editor (Thomas Wood,
+ Jens Granseuer)
+
+updated translations:
+- ar (Djihed Afifi)
+- gl (Ignacio Casal Quinteiro)
+- vi (Clytie Siddall)
+
+------------------------------------------------------------------------------
+gnome-control-center 2.23.2 (2008-05-17)
+
+about-me:
+- Fix image scaling on the photo button (Ben LeMasurier) (#309629)
+- Fix build on Solaris (Laszlo Peter) (#532893)
+- Properly handle errors when no icon is available (Jens Granseuer)
+- Fix handling of Home and Work email addresses (Jens Granseuer) (#317835)
+- Close a memory leak (Jens Granseuer)
+
+appearance:
+- Convert some more parts to gio (Lincoln de Sousa, Jens Granseuer)
+- Show errors for incomplete control themes (Jens Granseuer)
+- Add support for installing missing GTK+ theme engines via PackageKit
+ (Jens Granseuer) (#511065)
+
+keyboard:
+- Don't close the Keyboard Layout Options window when the Help button is
+ clicked (Thomas Wood) (#529772)
+- Access keyboard layouts by country or language (Sergey Udaltsov)
+
+network;
+- Drop gnome-vfs dependency (Jens Granseuer)
+
+sound:
+- Add support for OSS4 mixers (Tim-Phillip Mueller) (#529720)
+
+general:
+- libbackground is no longer needed (Soeren Sandmann)
+- Remove iso-codes dependency again (Sergey Udaltsov)
+- Require libxklavier 3.6 (Sergey Udaltsov)
+- Port theme handling code from gnome-vfs to gio (Jens Granseuer)
+
+updated translations:
+- es (Jorge Gonzalez)
+- fr (Stephane Raimbault)
+- gl (Ignacio Casal Quinteiro)
+- he (Yair Hershkovitz)
+- hu (Gabor Kelemen)
+- nb (Kjartan Maraas)
+- pt_BR (Leonardo Ferreira Fontenelle)
+
+------------------------------------------------------------------------------
gnome-control-center 2.23.1
about-me:
Modified: branches/randr-12/capplets/appearance/appearance-desktop.c
==============================================================================
--- branches/randr-12/capplets/appearance/appearance-desktop.c (original)
+++ branches/randr-12/capplets/appearance/appearance-desktop.c Tue Jun 17 23:18:22 2008
@@ -1,7 +1,8 @@
/*
- * Copyright (C) 2007 The GNOME Foundation
+ * Copyright (C) 2007,2008 The GNOME Foundation
* Written by Rodney Dawes <dobey ximian com>
* Denis Washington <denisw svn gnome org>
+ * Thomas Wood <thos gnome org>
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -46,6 +47,9 @@
{"text/uri-list", GTK_TARGET_OTHER_WIDGET, TARGET_URI_LIST}
};
+
+static void wp_update_preview (GtkFileChooser *chooser, AppearanceData *data);
+
static void
select_item (AppearanceData *data,
GnomeWPItem * item,
@@ -177,6 +181,9 @@
{
GnomeWPItem *item;
+ if (!filename)
+ return NULL;
+
item = g_hash_table_lookup (data->wp_hash, filename);
if (item != NULL)
@@ -422,7 +429,8 @@
if (item == NULL)
item = wp_add_image (data, uri);
- select_item (data, item, TRUE);
+ if (item)
+ select_item (data, item, TRUE);
}
}
@@ -611,12 +619,72 @@
}
}
+void
+wp_create_filechooser (AppearanceData *data)
+{
+ const char *start_dir, *pictures = NULL;
+ GtkFileFilter *filter;
+
+ data->wp_filesel = GTK_FILE_CHOOSER (
+ gtk_file_chooser_dialog_new_with_backend (_("Add Wallpaper"),
+ GTK_WINDOW (glade_xml_get_widget (data->xml, "appearance_window")),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ "gtk+",
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN,
+ GTK_RESPONSE_OK,
+ NULL));
+
+ gtk_dialog_set_default_response (GTK_DIALOG (data->wp_filesel), GTK_RESPONSE_OK);
+ gtk_file_chooser_set_select_multiple (data->wp_filesel, TRUE);
+ gtk_file_chooser_set_use_preview_label (data->wp_filesel, FALSE);
+
+ start_dir = g_get_home_dir ();
+
+ if (g_file_test ("/usr/share/backgrounds", G_FILE_TEST_IS_DIR)) {
+ gtk_file_chooser_add_shortcut_folder (data->wp_filesel,
+ "/usr/share/backgrounds", NULL);
+ start_dir = "/usr/share/backgrounds";
+ }
+
+ pictures = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
+ if (pictures != NULL && g_file_test (pictures, G_FILE_TEST_IS_DIR)) {
+ gtk_file_chooser_add_shortcut_folder (data->wp_filesel, pictures, NULL);
+ start_dir = pictures;
+ }
+
+ gtk_file_chooser_set_current_folder (data->wp_filesel, start_dir);
+
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_add_pixbuf_formats (filter);
+ gtk_file_filter_set_name (filter, _("Images"));
+ gtk_file_chooser_add_filter (data->wp_filesel, filter);
+
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("All files"));
+ gtk_file_filter_add_pattern (filter, "*");
+ gtk_file_chooser_add_filter (data->wp_filesel, filter);
+
+ data->wp_image = gtk_image_new ();
+ gtk_file_chooser_set_preview_widget (data->wp_filesel, data->wp_image);
+ gtk_widget_set_size_request (data->wp_image, 128, -1);
+
+ gtk_widget_show (data->wp_image);
+
+ g_signal_connect (data->wp_filesel, "update-preview",
+ (GCallback) wp_update_preview, data);
+}
+
static void
wp_file_open_dialog (GtkWidget *widget,
AppearanceData *data)
{
GSList *files;
+ if (!data->wp_filesel)
+ wp_create_filechooser (data);
+
switch (gtk_dialog_run (GTK_DIALOG (data->wp_filesel)))
{
case GTK_RESPONSE_OK:
@@ -684,8 +752,14 @@
GnomeWPItem *item = get_selected_item (data, NULL);
if (item != NULL) {
- gchar *uris[] = { item->filename, NULL };
+ char *uris[2];
+
+ uris[0] = g_filename_to_uri (item->filename, NULL, NULL);
+ uris[1] = NULL;
+
gtk_selection_data_set_uris (selection_data, uris);
+
+ g_free (uris[0]);
}
}
}
@@ -858,7 +932,8 @@
else if (strcmp (style, "none") != 0)
{
item = wp_add_image (data, imagepath);
- select_item (data, item, FALSE);
+ if (item)
+ select_item (data, item, FALSE);
}
item = g_hash_table_lookup (data->wp_hash, "(none)");
@@ -913,9 +988,6 @@
{
GtkWidget *add_button;
GtkCellRenderer *cr;
- GtkFileFilter *filter;
- const gchar *pictures;
- const gchar *start_dir;
g_object_set (gtk_settings_get_default (), "gtk-tooltip-timeout", 500, NULL);
@@ -1033,55 +1105,9 @@
wp_set_sensitivities (data);
- data->wp_filesel = GTK_FILE_CHOOSER (
- gtk_file_chooser_dialog_new_with_backend (_("Add Wallpaper"),
- GTK_WINDOW (glade_xml_get_widget (data->xml, "appearance_window")),
- GTK_FILE_CHOOSER_ACTION_OPEN,
- "gtk+",
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN,
- GTK_RESPONSE_OK,
- NULL));
-
- gtk_dialog_set_default_response (GTK_DIALOG (data->wp_filesel), GTK_RESPONSE_OK);
- gtk_file_chooser_set_select_multiple (data->wp_filesel, TRUE);
- gtk_file_chooser_set_use_preview_label (data->wp_filesel, FALSE);
-
- start_dir = g_get_home_dir ();
-
- if (g_file_test ("/usr/share/backgrounds", G_FILE_TEST_IS_DIR)) {
- gtk_file_chooser_add_shortcut_folder (data->wp_filesel,
- "/usr/share/backgrounds", NULL);
- start_dir = "/usr/share/backgrounds";
- }
-
- pictures = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
- if (pictures != NULL && g_file_test (pictures, G_FILE_TEST_IS_DIR)) {
- gtk_file_chooser_add_shortcut_folder (data->wp_filesel, pictures, NULL);
- start_dir = pictures;
- }
-
- gtk_file_chooser_set_current_folder (data->wp_filesel, start_dir);
-
- filter = gtk_file_filter_new ();
- gtk_file_filter_add_pixbuf_formats (filter);
- gtk_file_filter_set_name (filter, _("Images"));
- gtk_file_chooser_add_filter (data->wp_filesel, filter);
-
- filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (filter, _("All files"));
- gtk_file_filter_add_pattern (filter, "*");
- gtk_file_chooser_add_filter (data->wp_filesel, filter);
-
- data->wp_image = gtk_image_new ();
- gtk_file_chooser_set_preview_widget (data->wp_filesel, data->wp_image);
- gtk_widget_set_size_request (data->wp_image, 128, -1);
-
- gtk_widget_show (data->wp_image);
+ /* create the file selector later to save time on startup */
+ data->wp_filesel = NULL;
- g_signal_connect (data->wp_filesel, "update-preview",
- (GCallback) wp_update_preview, data);
}
void
@@ -1090,6 +1116,9 @@
gnome_wp_xml_save_list (data);
g_slist_foreach (data->wp_uris, (GFunc) g_free, NULL);
g_slist_free (data->wp_uris);
- g_object_ref_sink (data->wp_filesel);
- g_object_unref (data->wp_filesel);
+ if (data->wp_filesel)
+ {
+ g_object_ref_sink (data->wp_filesel);
+ g_object_unref (data->wp_filesel);
+ }
}
Modified: branches/randr-12/capplets/appearance/appearance-main.c
==============================================================================
--- branches/randr-12/capplets/appearance/appearance-main.c (original)
+++ branches/randr-12/capplets/appearance/appearance-main.c Tue Jun 17 23:18:22 2008
@@ -49,7 +49,6 @@
g_thread_init (NULL);
theme_thumbnail_factory_init (*argc, *argv);
gtk_init (argc, argv);
- gnome_vfs_init ();
activate_settings_daemon ();
/* set up the data */
Modified: branches/randr-12/capplets/appearance/gnome-wp-info.c
==============================================================================
--- branches/randr-12/capplets/appearance/gnome-wp-info.c (original)
+++ branches/randr-12/capplets/appearance/gnome-wp-info.c Tue Jun 17 23:18:22 2008
@@ -19,6 +19,7 @@
*/
#include <config.h>
+#include <string.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
#include "gnome-wp-info.h"
Modified: branches/randr-12/capplets/appearance/gnome-wp-item.c
==============================================================================
--- branches/randr-12/capplets/appearance/gnome-wp-item.c (original)
+++ branches/randr-12/capplets/appearance/gnome-wp-item.c Tue Jun 17 23:18:22 2008
@@ -30,7 +30,7 @@
{ GNOME_BG_PLACEMENT_CENTERED, "centered" },
{ GNOME_BG_PLACEMENT_FILL_SCREEN, "stretched" },
{ GNOME_BG_PLACEMENT_SCALED, "scaled" },
- { GNOME_BG_PLACEMENT_ZOOMED, "zoomed" },
+ { GNOME_BG_PLACEMENT_ZOOMED, "zoom" },
{ GNOME_BG_PLACEMENT_TILED, "wallpaper" },
{ 0, NULL }
};
@@ -69,7 +69,7 @@
static void set_bg_properties (GnomeWPItem *item)
{
if (item->filename)
- gnome_bg_set_uri (item->bg, item->filename);
+ gnome_bg_set_filename (item->bg, item->filename);
gnome_bg_set_color (item->bg, item->shade_type, item->pcolor, item->scolor);
gnome_bg_set_placement (item->bg, item->options);
Modified: branches/randr-12/capplets/appearance/theme-installer.c
==============================================================================
--- branches/randr-12/capplets/appearance/theme-installer.c (original)
+++ branches/randr-12/capplets/appearance/theme-installer.c Tue Jun 17 23:18:22 2008
@@ -26,6 +26,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
+#include <glib/gstdio.h>
#include "file-transfer-dialog.h"
#include "theme-installer.h"
@@ -48,17 +49,18 @@
DIRECTORY
};
-static void
-cleanup_tmp_dir (const gchar *tmp_dir)
+static gboolean
+cleanup_tmp_dir (GIOSchedulerJob *job,
+ GCancellable *cancellable,
+ const gchar *tmp_dir)
{
- if (gnome_vfs_remove_directory (tmp_dir) == GNOME_VFS_ERROR_DIRECTORY_NOT_EMPTY) {
- GList *list;
+ GFile *directory;
- list = g_list_prepend (NULL, gnome_vfs_uri_new (tmp_dir));
- gnome_vfs_xfer_delete_list (list, GNOME_VFS_XFER_RECURSIVE,
- GNOME_VFS_XFER_ERROR_MODE_ABORT, NULL, NULL);
- gnome_vfs_uri_list_free (list);
- }
+ directory = g_file_new_for_path (tmp_dir);
+ file_delete_recursive (directory, NULL);
+ g_object_unref (directory);
+
+ return FALSE;
}
static int
@@ -74,16 +76,12 @@
exists = g_file_test (filename, G_FILE_TEST_IS_REGULAR);
if (exists) {
- GPatternSpec *pattern = NULL;
+ GPatternSpec *pattern;
gchar *file_contents = NULL;
- gint file_size;
- gchar *uri;
+ gsize file_size;
gboolean match;
- uri = gnome_vfs_get_uri_from_local_path (filename);
- g_free (filename);
- gnome_vfs_read_entire_file (uri, &file_size, &file_contents);
- g_free (uri);
+ g_file_get_contents (filename, &file_contents, &file_size, NULL);
pattern = g_pattern_spec_new ("*[Icon Theme]*");
match = g_pattern_match_string (pattern, file_contents);
@@ -93,6 +91,7 @@
pattern = g_pattern_spec_new ("*Directories=*");
match = g_pattern_match_string (pattern, file_contents);
g_pattern_spec_free (pattern);
+ g_free (file_contents);
if (match) {
/* check if we have a cursor, too */
@@ -111,6 +110,7 @@
pattern = g_pattern_spec_new ("*[X-GNOME-Metatheme]*");
match = g_pattern_match_string (pattern, file_contents);
g_pattern_spec_free (pattern);
+ g_free (file_contents);
if (match)
return THEME_GNOME;
@@ -153,7 +153,12 @@
static void
transfer_cancel_cb (GtkWidget *dlg, gchar *path)
{
- gnome_vfs_unlink (path);
+ GFile *todelete;
+
+ todelete = g_file_new_for_path (path);
+ g_file_delete (todelete, NULL, NULL);
+
+ g_object_unref (todelete);
g_free (path);
gtk_widget_destroy (dlg);
}
@@ -259,8 +264,8 @@
{
gboolean success = TRUE;
GtkWidget *dialog, *apply_button;
- int xfer_options;
- GnomeVFSURI *theme_source_dir, *theme_dest_dir;
+ GFile *theme_source_dir, *theme_dest_dir;
+ GError *error = NULL;
gint theme_type;
gchar *user_message = NULL;
gchar *target_dir = NULL;
@@ -307,13 +312,25 @@
&& (file_theme_type (path) == THEME_ICON))
{
gchar *new_path, *update_icon_cache;
+ GFile *new_file;
+ GFile *src_file;
+ src_file = g_file_new_for_path (path);
new_path = g_build_path (G_DIR_SEPARATOR_S,
g_get_home_dir (),
".icons",
theme_name, NULL);
- /* XXX: make some noise if we couldn't install it? */
- gnome_vfs_move (path, new_path, FALSE);
+ new_file = g_file_new_for_path (new_path);
+
+ if (!g_file_move (src_file, new_file, G_FILE_COPY_NONE,
+ NULL, NULL, NULL, &error)) {
+ g_warning ("Error while moving from `%s' to `%s': %s",
+ path, new_path, error->message);
+ g_error_free (error);
+ error = NULL;
+ }
+ g_object_unref (new_file);
+ g_object_unref (src_file);
/* update icon cache - shouldn't really matter if this fails */
update_icon_cache = g_strdup_printf ("gtk-update-icon-cache %s", new_path);
@@ -326,17 +343,12 @@
}
/* Move the dir to the target dir */
- theme_source_dir = gnome_vfs_uri_new (tmp_dir);
- theme_dest_dir = gnome_vfs_uri_new (target_dir);
+ theme_source_dir = g_file_new_for_path (tmp_dir);
+ theme_dest_dir = g_file_new_for_path (target_dir);
- xfer_options = GNOME_VFS_XFER_RECURSIVE;
- if (filetype != DIRECTORY)
- xfer_options |= GNOME_VFS_XFER_REMOVESOURCE;
-
- if (gnome_vfs_xfer_uri (theme_source_dir, theme_dest_dir, xfer_options,
- GNOME_VFS_XFER_ERROR_MODE_ABORT,
- GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
- NULL, NULL) != GNOME_VFS_OK) {
+ if (!g_file_move (theme_source_dir, theme_dest_dir,
+ G_FILE_COPY_OVERWRITE, NULL, NULL,
+ NULL, &error)) {
gchar *str;
str = g_strdup_printf (_("Installation for theme \"%s\" failed."), theme_name);
@@ -345,7 +357,13 @@
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
str);
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ error->message);
+
g_free (str);
+ g_error_free (error);
+ error = NULL;
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
success = FALSE;
@@ -475,12 +493,13 @@
gchar *tmp_dir;
gboolean ok;
gint n_themes;
+ GFile *todelete;
tmp_dir = g_strdup_printf ("%s/.themes/.theme-%u",
g_get_home_dir (),
g_random_int ());
- if ((gnome_vfs_make_directory (tmp_dir, 0700)) != GNOME_VFS_OK) {
+ if ((g_mkdir (tmp_dir, 0700)) != 0) {
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
_("Failed to create temporary directory"));
@@ -491,17 +510,20 @@
return;
}
-
if (!transfer_done_archive (filetype, tmp_dir, path) ||
((dir = g_dir_open (tmp_dir, 0, NULL)) == NULL))
{
- cleanup_tmp_dir (tmp_dir);
+ g_io_scheduler_push_job ((GIOSchedulerJobFunc) cleanup_tmp_dir,
+ g_strdup (tmp_dir), g_free,
+ G_PRIORITY_DEFAULT, NULL);
g_free (tmp_dir);
g_free (path);
return;
}
- gnome_vfs_unlink (path);
+ todelete = g_file_new_for_path (path);
+ g_file_delete (todelete, NULL, NULL);
+ g_object_unref (todelete);
/* See whether we have multiple themes to install. If so,
* we won't ask the user whether to apply the new theme
@@ -547,9 +569,9 @@
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
-
- cleanup_tmp_dir (tmp_dir);
- g_free (tmp_dir);
+ g_io_scheduler_push_job ((GIOSchedulerJobFunc) cleanup_tmp_dir,
+ tmp_dir, g_free,
+ G_PRIORITY_DEFAULT, NULL);
}
g_free (path);
Modified: branches/randr-12/capplets/appearance/theme-util.c
==============================================================================
--- branches/randr-12/capplets/appearance/theme-util.c (original)
+++ branches/randr-12/capplets/appearance/theme-util.c Tue Jun 17 23:18:22 2008
@@ -59,10 +59,13 @@
}
g_file_enumerator_close (enumerator, NULL, NULL);
+ if (success)
+ success = g_file_delete (directory, NULL, error);
+
return success;
}
-static gboolean
+gboolean
file_delete_recursive (GFile *file, GError **error)
{
GFileInfo *info;
@@ -97,7 +100,7 @@
if (info == NULL || info->path == NULL)
return FALSE;
- file = g_file_new_for_uri (info->path);
+ file = g_file_new_for_path (info->path);
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE,
G_FILE_QUERY_INFO_NONE,
@@ -165,7 +168,7 @@
return FALSE;
}
- dir = g_file_new_for_uri (theme_dir);
+ dir = g_file_new_for_path (theme_dir);
g_free (theme_dir);
if (!file_delete_recursive (dir, NULL)) {
Modified: branches/randr-12/capplets/appearance/theme-util.h
==============================================================================
--- branches/randr-12/capplets/appearance/theme-util.h (original)
+++ branches/randr-12/capplets/appearance/theme-util.h Tue Jun 17 23:18:22 2008
@@ -60,3 +60,4 @@
void theme_install_file (GtkWindow *parent, const gchar *path);
gboolean packagekit_available (void);
+gboolean file_delete_recursive (GFile *directory, GError **error);
Modified: branches/randr-12/capplets/common/Makefile.am
==============================================================================
--- branches/randr-12/capplets/common/Makefile.am (original)
+++ branches/randr-12/capplets/common/Makefile.am Tue Jun 17 23:18:22 2008
@@ -7,7 +7,6 @@
-DG_LOG_DOMAIN=\"capplet-common\" \
-DINSTALL_PREFIX=\"$(prefix)\" \
-I$(top_srcdir) \
- -I$(top_srcdir)/libbackground \
-I$(top_srcdir)/libwindow-settings \
$(DBUS_CFLAGS) \
$(GNOME_DESKTOP_CFLAGS) \
@@ -41,7 +40,7 @@
wm-common.c \
wm-common.h
-libcommon_la_LIBADD = $(top_builddir)/libbackground/libbackground.la \
+libcommon_la_LIBADD = \
$(top_builddir)/libwindow-settings/libgnome-window-settings.la \
$(METACITY_LIBS) \
$(DBUS_LIBS) \
Modified: branches/randr-12/capplets/common/capplet-util.c
==============================================================================
--- branches/randr-12/capplets/common/capplet-util.c (original)
+++ branches/randr-12/capplets/common/capplet-util.c Tue Jun 17 23:18:22 2008
@@ -34,271 +34,7 @@
#include "capplet-util.h"
-#if 0
-
-/* apply_cb
- *
- * Callback issued when the user clicks "Apply" or "Ok". This function is
- * responsible for making sure the current settings are properly saved.
- */
-
static void
-apply_cb (BonoboPropertyControl *pc, Bonobo_PropertyControl_Action action)
-{
- if (action == Bonobo_PropertyControl_APPLY)
- gconf_engine_commit_change_set (gconf_engine_get_default (),
- changeset, TRUE, NULL);
-}
-
-/* properties_changed_cb
- *
- * Callback issued when some setting has changed
- */
-
-static void
-properties_changed_cb (GConfEngine *engine, guint cnxn_id, GConfEntry *entry, gpointer user_data)
-{
- if (apply_settings_cb != NULL)
- apply_settings_cb ();
-}
-
-/* get_control_cb
- *
- * Callback to construct the main dialog box for this capplet; invoked by Bonobo
- * whenever capplet activation is requested. Returns a BonoboObject representing
- * the control that encapsulates the object.
- */
-
-static BonoboObject *
-get_control_cb (BonoboPropertyControl *property_control, gint page_number)
-{
- BonoboControl *control;
- GtkWidget *widget;
-
- widget = create_dialog_cb ();
-
- if (widget == NULL)
- return NULL;
-
- control = bonobo_control_new (widget);
- setup_property_editors_cb (widget, changeset);
-
- bonobo_control_set_automerge (control, TRUE);
-
- return BONOBO_OBJECT (control);
-}
-
-/* create_control_cb
- *
- * Small function to create the PropertyControl and return it.
- */
-
-static BonoboObject *
-create_control_cb (BonoboGenericFactory *factory, const gchar *component_id)
-{
- BonoboObject *obj;
- BonoboPropertyControl *property_control;
-
- static const gchar *prefix1 = "OAFIID:Bonobo_Control_Capplet_";
-
- g_message ("%s: Enter", G_GNUC_FUNCTION);
-
- if (!strncmp (component_id, prefix1, strlen (prefix1))) {
- property_control = bonobo_property_control_new
- ((BonoboPropertyControlGetControlFn) get_control_cb, 1, NULL);
- g_signal_connect (G_OBJECT (property_control), "action",
- G_CALLBACK (apply_cb), NULL);
- obj = BONOBO_OBJECT (property_control);
- } else {
- g_critical ("Not creating %s", component_id);
- obj = NULL;
- }
-
- return obj;
-}
-
-/* get_factory_name
- *
- * Construct the OAF IID of the factory from the binary name
- */
-
-static gchar *
-get_factory_name (const gchar *binary)
-{
- gchar *s, *tmp, *tmp1, *res;
-
- s = g_strdup (binary);
- tmp = strrchr (s, '/');
- if (tmp == NULL) tmp = s;
- else tmp++;
- if ((tmp1 = strstr (tmp, "-control")) != NULL) *tmp1 = '\0';
- if ((tmp1 = strstr (tmp, "-capplet")) != NULL) *tmp1 = '\0';
- while ((tmp1 = strchr (tmp, '-')) != NULL) *tmp1 = '_';
-
- res = g_strconcat ("OAFIID:Bonobo_", tmp, "_Factory", NULL);
- g_free (s);
- return res;
-}
-
-/* get_property_name
- *
- * Get the property name associated with this capplet
- */
-
-static gchar *
-get_property_name (const gchar *binary)
-{
- gchar *s, *tmp, *tmp1, *res;
-
- s = g_strdup (binary);
- tmp = strrchr (s, '/');
- if (tmp == NULL) tmp = s;
- else tmp++;
- if ((tmp1 = strstr (tmp, "-control")) != NULL) *tmp1 = '\0';
- if ((tmp1 = strstr (tmp, "-capplet")) != NULL) *tmp1 = '\0';
-
- for (tmp1 = tmp; *tmp1 != '\0'; tmp1++) {
- *tmp1 = toupper (*tmp1);
- if (*tmp1 == '-') *tmp1 = '_';
- }
-
- res = g_strconcat ("GNOME_", tmp, NULL);
- g_free (s);
- return res;
-}
-
-#endif
-
-/* setup_session_mgmt
- *
- * Make sure the capplet launches and applies its settings next time the user
- * logs in
- */
-
-void
-setup_session_mgmt (const gchar *binary_name)
-{
-/* Disabled. I never really understood this code anyway, and I am absolutely
- * unclear about how to port it to GNOME 2.0 */
-#if 0
- GnomeClient *client;
- GnomeClientFlags flags;
- gint token;
- gchar *restart_args[3];
- gchar *prop_name;
-
- g_return_if_fail (binary_name != NULL);
-
- client = gnome_master_client ();
- flags = gnome_client_get_flags (client);
-
- if (flags & GNOME_CLIENT_IS_CONNECTED) {
- prop_name = get_property_name (binary_name);
- token = gnome_startup_acquire_token
- (prop_name, gnome_client_get_id (client));
- g_free (prop_name);
-
- if (token) {
- gnome_client_set_priority (client, 20);
- gnome_client_set_restart_style
- (client, GNOME_RESTART_ANYWAY);
- restart_args[0] = g_strdup (binary_name);
- restart_args[1] = "--init-session-settings";
- restart_args[2] = NULL;
- gnome_client_set_restart_command
- (client, 2, restart_args);
- g_free (restart_args[0]);
- } else {
- gnome_client_set_restart_style
- (client, GNOME_RESTART_NEVER);
- }
- }
-#endif
-}
-
-#if 0
-
-/* capplet_init -- see documentation in capplet-util.h
- */
-
-void
-capplet_init (int argc,
- char **argv,
- ApplySettingsFn apply_fn,
- CreateDialogFn create_dialog_fn,
- SetupPropertyEditorsFn setup_fn,
- GetLegacySettingsFn get_legacy_fn)
-{
- gchar *factory_iid;
- BonoboGenericFactory *factory;
- GOptionContext *context;
-
- static gboolean apply_only;
- static gboolean get_legacy;
- static GOptionEntry cap_options[] = {
- { "apply", 0, 0, G_OPTION_ARG_NONE, &apply_only,
- N_("Just apply settings and quit"), NULL },
- { "init-session-settings", 0, 0, G_OPTION_ARG_NONE, &apply_only,
- N_("Just apply settings and quit"), NULL },
- { "get-legacy", 0, 0, G_OPTION_ARG_NONE, &get_legacy,
- N_("Retrieve and store legacy settings"), NULL },
- { NULL }
- };
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- context = g_option_context_new (NULL);
- g_option_context_add_main_entries (context, cap_options, GETTEXT_PACKAGE);
-
- gnome_program_init (argv[0], VERSION, LIBGNOMEUI_MODULE, argc, argv,
- GNOME_PARAM_GOPTION_CONTEXT, context,
- NULL);
-
- if (!bonobo_init (&argc, argv))
- g_error ("Cannot initialize bonobo");
-
- if (apply_only && apply_fn != NULL) {
- setup_session_mgmt (argv[0]);
- apply_fn ();
- }
- else if (get_legacy && get_legacy_fn != NULL) {
- setup_session_mgmt (argv[0]);
- get_legacy_fn ();
- } else {
- setup_session_mgmt (argv[0]);
-
- create_dialog_cb = create_dialog_fn;
- apply_settings_cb = apply_fn;
- setup_property_editors_cb = setup_fn;
-
- factory_iid = get_factory_name (argv[0]);
- factory = bonobo_generic_factory_new
- (factory_iid, (BonoboFactoryCallback) create_control_cb, NULL);
- g_free (factory_iid);
- bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
-
- changeset = gconf_change_set_new ();
-
- bonobo_main ();
-
- gconf_change_set_unref (changeset);
- }
-}
-
-#endif
-
-
-/**
- * capplet_error_dialog :
- *
- * @parent :
- * @msg : already translated.
- * @err :
- *
- */
-void
capplet_error_dialog (GtkWindow *parent, char const *msg, GError *err)
{
if (err != NULL) {
Modified: branches/randr-12/capplets/common/capplet-util.h
==============================================================================
--- branches/randr-12/capplets/common/capplet-util.h (original)
+++ branches/randr-12/capplets/common/capplet-util.h Tue Jun 17 23:18:22 2008
@@ -42,49 +42,8 @@
if (!def) \
gconf_client_set_##type (client, key, val_##type, NULL);
-/* Callback to apply the settings in the given database */
-typedef void (*ApplySettingsFn) (void);
+/* Some miscellaneous functions useful to all capplets */
-/* Callback to set up the dialog proper */
-typedef GtkWidget *(*CreateDialogFn) (void);
-
-/* Callback to set up property editors for the dialog */
-typedef void (*SetupPropertyEditorsFn) (GtkWidget *dialog, GConfChangeSet *changeset);
-
-/* Callback to retrieve legacy settings and store them in the new configuration
- * database */
-typedef void (*GetLegacySettingsFn) (void);
-
-/* Set up the session management so that this capplet will apply its
- * settings on every startup
- */
-
-void setup_session_mgmt (const gchar *binary_name);
-
-/* Wrapper function for the entire capplet. This handles all initialization and
- * runs the capplet for you. Just supply the appropriate callbacks and your argc
- * and argv from main()
- *
- * This function makes several assumptions, requiring that all capplets follow a
- * particular convention. In particular, suppose the name of the capplet binary
- * is foo-properties-capplet. Then:
- *
- * - The factory IID is Bonobo_Control_Capplet_foo_properties_Factory
- * - The default configuration moniker is archiver:foo-properties
- *
- * Following this convention yields capplets that are more uniform and thus
- * easier to maintain, and simplifies the interfaces quite a bit. All capplet in
- * this package are required to follow this convention.
- */
-
-void capplet_init (int argc,
- gchar **argv,
- ApplySettingsFn apply_fn,
- CreateDialogFn create_dialog_fn,
- SetupPropertyEditorsFn setup_property_editors_fn,
- GetLegacySettingsFn get_legacy_settings_fn);
-
-void capplet_error_dialog (GtkWindow *parent, char const *msg, GError *err);
void capplet_help (GtkWindow *parent, char const *helpfile, char const *section);
void capplet_set_icon (GtkWidget *window, char const *icon_file_name);
Modified: branches/randr-12/capplets/common/gconf-property-editor.c
==============================================================================
--- branches/randr-12/capplets/common/gconf-property-editor.c (original)
+++ branches/randr-12/capplets/common/gconf-property-editor.c Tue Jun 17 23:18:22 2008
@@ -48,8 +48,6 @@
PROP_DATA_FREE_CB
};
-typedef void (*GConfPropertyEditorDataFreeCb) (gpointer data);
-
struct _GConfPropertyEditorPrivate
{
gchar *key;
@@ -61,8 +59,8 @@
GConfClientNotifyFunc callback;
gboolean inited;
- gpointer data;
- GConfPropertyEditorDataFreeCb data_free_cb;
+ gpointer data;
+ GFreeFunc data_free_cb;
};
typedef struct
@@ -76,13 +74,6 @@
static guint peditor_signals[LAST_SIGNAL];
-static GObjectClass *parent_class;
-
-static void gconf_property_editor_init (GConfPropertyEditor *gconf_property_editor,
- GConfPropertyEditorClass *class);
-static void gconf_property_editor_class_init (GConfPropertyEditorClass *class);
-static void gconf_property_editor_base_init (GConfPropertyEditorClass *class);
-
static void gconf_property_editor_set_prop (GObject *object,
guint prop_id,
const GValue *value,
@@ -103,33 +94,11 @@
const gchar *first_custom,
...);
-GType
-gconf_property_editor_get_type (void)
-{
- static GType gconf_property_editor_type = 0;
+G_DEFINE_TYPE (GConfPropertyEditor, gconf_property_editor, G_TYPE_OBJECT)
- if (!gconf_property_editor_type) {
- GTypeInfo gconf_property_editor_info = {
- sizeof (GConfPropertyEditorClass),
- (GBaseInitFunc) gconf_property_editor_base_init,
- NULL, /* GBaseFinalizeFunc */
- (GClassInitFunc) gconf_property_editor_class_init,
- NULL, /* GClassFinalizeFunc */
- NULL, /* user-supplied data */
- sizeof (GConfPropertyEditor),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gconf_property_editor_init,
- NULL
- };
-
- gconf_property_editor_type =
- g_type_register_static (G_TYPE_OBJECT,
- "GConfPropertyEditor",
- &gconf_property_editor_info, 0);
- }
+#define GCONF_PROPERTY_EDITOR_GET_PRIVATE(object) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((object), gconf_property_editor_get_type (), GConfPropertyEditorPrivate))
- return gconf_property_editor_type;
-}
static GConfValue*
gconf_property_editor_conv_default (GConfPropertyEditor *peditor,
@@ -139,21 +108,15 @@
}
static void
-gconf_property_editor_init (GConfPropertyEditor *gconf_property_editor,
- GConfPropertyEditorClass *class)
+gconf_property_editor_init (GConfPropertyEditor *gconf_property_editor)
{
- gconf_property_editor->p = g_new0 (GConfPropertyEditorPrivate, 1);
+ gconf_property_editor->p = GCONF_PROPERTY_EDITOR_GET_PRIVATE (gconf_property_editor);
gconf_property_editor->p->conv_to_widget_cb = gconf_property_editor_conv_default;
gconf_property_editor->p->conv_from_widget_cb = gconf_property_editor_conv_default;
gconf_property_editor->p->inited = FALSE;
}
static void
-gconf_property_editor_base_init (GConfPropertyEditorClass *class)
-{
-}
-
-static void
gconf_property_editor_class_init (GConfPropertyEditorClass *class)
{
GObjectClass *object_class;
@@ -216,7 +179,7 @@
g_param_spec_pointer ("data",
_("Property editor object data"),
_("Custom data required by the specific property editor"),
- G_PARAM_WRITABLE));
+ G_PARAM_READWRITE));
g_object_class_install_property
(object_class, PROP_DATA_FREE_CB,
@@ -225,8 +188,7 @@
_("Callback to be issued when property editor object data is to be freed"),
G_PARAM_WRITABLE));
- parent_class = G_OBJECT_CLASS
- (g_type_class_ref (G_TYPE_OBJECT));
+ g_type_class_add_private (class, sizeof (GConfPropertyEditorPrivate));
}
static void
@@ -314,6 +276,9 @@
g_value_set_pointer (value, peditor->p->changeset);
break;
+ case PROP_DATA:
+ g_value_set_pointer (value, peditor->p->data);
+ break;
default:
g_warning ("Bad argument get");
break;
@@ -344,9 +309,7 @@
g_object_unref (client);
}
- g_free (gconf_property_editor->p);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (gconf_property_editor_parent_class)->finalize (object);
}
static GObject *
@@ -388,7 +351,7 @@
GCONF_PROPERTY_EDITOR (obj)->p->callback (client, 0, gconf_entry, obj);
GCONF_PROPERTY_EDITOR (obj)->p->inited = TRUE;
gconf_entry_free (gconf_entry);
- g_object_unref (G_OBJECT (client));
+ g_object_unref (client);
return obj;
}
@@ -490,7 +453,7 @@
va_end (var_args);
- g_signal_connect_swapped (G_OBJECT (checkbox), "toggled",
+ g_signal_connect_swapped (checkbox, "toggled",
(GCallback) peditor_boolean_widget_changed, peditor);
return peditor;
@@ -559,7 +522,7 @@
first_property_name,
var_args, NULL);
- g_signal_connect_swapped (G_OBJECT (entry), "changed",
+ g_signal_connect_swapped (entry, "changed",
(GCallback) peditor_integer_widget_changed, peditor);
return peditor;
@@ -653,7 +616,7 @@
first_property_name,
var_args, NULL);
- g_signal_connect_swapped (G_OBJECT (entry), "changed",
+ g_signal_connect_swapped (entry, "changed",
(GCallback) peditor_string_widget_changed, peditor);
return peditor;
@@ -788,7 +751,7 @@
va_end (var_args);
- g_signal_connect_swapped (G_OBJECT (cb), "color_set",
+ g_signal_connect_swapped (cb, "color_set",
(GCallback) peditor_color_widget_changed, peditor);
return peditor;
@@ -941,7 +904,7 @@
va_end (var_args);
- g_signal_connect_swapped (G_OBJECT (combo_box), "changed",
+ g_signal_connect_swapped (combo_box, "changed",
(GCallback) peditor_combo_box_widget_changed, peditor);
return peditor;
@@ -991,7 +954,7 @@
va_end (var_args);
- g_signal_connect_swapped (G_OBJECT (combo_box), "changed",
+ g_signal_connect_swapped (combo_box, "changed",
(GCallback) peditor_combo_box_widget_changed, peditor);
return peditor;
@@ -1078,7 +1041,7 @@
va_end (var_args);
for (item = radio_group; item != NULL; item = item->next)
- g_signal_connect_swapped (G_OBJECT (item->data), "toggled",
+ g_signal_connect_swapped (item->data, "toggled",
(GCallback) peditor_select_radio_widget_changed, peditor);
return peditor;
@@ -1190,7 +1153,7 @@
(key,
(GConfClientNotifyFunc) peditor_numeric_range_value_changed,
changeset,
- G_OBJECT (adjustment),
+ adjustment,
first_property_name,
var_args, NULL);
@@ -1237,7 +1200,6 @@
g_return_if_fail (GTK_IS_WIDGET (widget));
client = gconf_client_get_default ();
-
value = gconf_client_get (client, peditor->p->key, NULL);
g_object_unref (client);
@@ -1248,7 +1210,7 @@
g_warning ("NULL GConf value: %s: possibly incomplete setup", peditor->p->key);
}
- g_signal_connect (G_OBJECT (peditor), "value-changed", (GCallback) guard_value_changed, widget);
+ g_signal_connect (peditor, "value-changed", (GCallback) guard_value_changed, widget);
}
GConfValue *
@@ -1442,7 +1404,7 @@
va_end (var_args);
- g_signal_connect_swapped (G_OBJECT (checkbox), "toggled",
+ g_signal_connect_swapped (checkbox, "toggled",
(GCallback) peditor_boolean_widget_changed, peditor);
return peditor;
@@ -1519,7 +1481,7 @@
}
gtk_image_set_from_pixbuf (image, pixbuf);
- g_object_unref (G_OBJECT (pixbuf));
+ g_object_unref (pixbuf);
return TRUE;
}
@@ -1637,10 +1599,10 @@
if (filename && strcmp (filename, ""))
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (chooser), filename);
- g_signal_connect (G_OBJECT (chooser), "update-preview",
+ g_signal_connect (chooser, "update-preview",
G_CALLBACK (peditor_image_chooser_update_preview_cb),
preview);
- g_signal_connect (G_OBJECT (chooser), "response",
+ g_signal_connect (chooser, "response",
G_CALLBACK (peditor_image_chooser_response_cb),
peditor);
@@ -1700,7 +1662,7 @@
va_end (var_args);
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
(GCallback) peditor_image_clicked_cb, peditor);
return peditor;
@@ -1754,7 +1716,7 @@
va_end (var_args);
for (item = radio_group; item != NULL; item = item->next)
- g_signal_connect_swapped (G_OBJECT (item->data), "toggled",
+ g_signal_connect_swapped (item->data, "toggled",
(GCallback) peditor_select_radio_widget_changed, peditor);
return peditor;
Modified: branches/randr-12/capplets/common/gnome-theme-info.c
==============================================================================
--- branches/randr-12/capplets/common/gnome-theme-info.c (original)
+++ branches/randr-12/capplets/common/gnome-theme-info.c Tue Jun 17 23:18:22 2008
@@ -269,14 +269,14 @@
meta_theme_file = g_file_get_uri (meta_theme_uri);
meta_theme_ditem = gnome_desktop_item_new_from_uri (meta_theme_file, 0, NULL);
- if (meta_theme_ditem == NULL) {
- g_free (meta_theme_file);
+ g_free (meta_theme_file);
+
+ if (meta_theme_ditem == NULL)
return NULL;
- }
common_theme_dir_uri = g_file_get_parent (meta_theme_uri);
meta_theme_info = gnome_theme_meta_info_new ();
- meta_theme_info->path = meta_theme_file;
+ meta_theme_info->path = g_file_get_path (meta_theme_uri);
meta_theme_info->name = g_file_get_basename (common_theme_dir_uri);
g_object_unref (common_theme_dir_uri);
@@ -390,15 +390,14 @@
icon_theme_file = g_file_get_uri (icon_theme_uri);
icon_theme_ditem = gnome_desktop_item_new_from_uri (icon_theme_file, 0, NULL);
- if (icon_theme_ditem == NULL) {
- g_free (icon_theme_file);
+ g_free (icon_theme_file);
+
+ if (icon_theme_ditem == NULL)
return NULL;
- }
name = gnome_desktop_item_get_string (icon_theme_ditem, "Icon Theme/Name");
if (name == NULL) {
gnome_desktop_item_unref (icon_theme_ditem);
- g_free (icon_theme_file);
return NULL;
}
@@ -406,7 +405,6 @@
directories = gnome_desktop_item_get_string (icon_theme_ditem, "Icon Theme/Directories");
if (directories == NULL) {
gnome_desktop_item_unref (icon_theme_ditem);
- g_free (icon_theme_file);
return NULL;
}
@@ -416,13 +414,12 @@
gchar *dir_name;
icon_theme_info = gnome_theme_icon_info_new ();
icon_theme_info->readable_name = g_strdup (name);
- icon_theme_info->path = icon_theme_file;
- dir_name = g_path_get_dirname (icon_theme_file);
+ icon_theme_info->path = g_file_get_path (icon_theme_uri);
+ dir_name = g_path_get_dirname (icon_theme_info->path);
icon_theme_info->name = g_path_get_basename (dir_name);
g_free (dir_name);
} else {
icon_theme_info = NULL;
- g_free (icon_theme_file);
}
gnome_desktop_item_unref (icon_theme_ditem);
@@ -538,7 +535,7 @@
}
cursor_theme_info = gnome_theme_cursor_info_new ();
- cursor_theme_info->path = g_file_get_uri (parent_uri);
+ cursor_theme_info->path = g_file_get_path (parent_uri);
cursor_theme_info->name = name;
cursor_theme_info->sizes = sizes;
cursor_theme_info->thumbnail = thumbnail;
@@ -664,7 +661,7 @@
theme_info->thumbnail = gdk_pixbuf_new_from_file (filename, NULL);
g_free (filename);
- theme_info->path = g_build_filename ("file://" GNOMECC_DATA_DIR, builtins[i][0], NULL);
+ theme_info->path = g_build_filename (GNOMECC_DATA_DIR, builtins[i][0], NULL);
theme_info->name = g_strdup (theme_info->path);
if (!strcmp (theme_info->path, cursor_font))
@@ -759,7 +756,7 @@
/* Next, we see what currently exists */
parent = g_file_get_parent (index_uri);
common_theme_dir_uri = g_file_get_parent (parent);
- common_theme_dir = g_file_get_uri (common_theme_dir_uri);
+ common_theme_dir = g_file_get_path (common_theme_dir_uri);
theme_info = g_hash_table_lookup (theme_hash_by_uri, common_theme_dir);
if (theme_info == NULL) {
Modified: branches/randr-12/capplets/default-applications/Makefile.am
==============================================================================
--- branches/randr-12/capplets/default-applications/Makefile.am (original)
+++ branches/randr-12/capplets/default-applications/Makefile.am Tue Jun 17 23:18:22 2008
@@ -42,5 +42,30 @@
-DGNOMECC_GLADE_DIR=\""$(gladedir)"\" \
-DGNOMECC_DATA_DIR=\""$(pkgdatadir)"\"
+
+icons16dir = $(datadir)/icons/hicolor/16x16/apps
+dist_icons16_DATA = icons/16x16/gnome-settings-default-applications.png
+icons22dir = $(datadir)/icons/hicolor/22x22/apps
+dist_icons22_DATA = icons/22x22/gnome-settings-default-applications.png
+icons24dir = $(datadir)/icons/hicolor/24x24/apps
+dist_icons24_DATA = icons/24x24/gnome-settings-default-applications.png
+icons32dir = $(datadir)/icons/hicolor/32x32/apps
+dist_icons32_DATA = icons/32x32/gnome-settings-default-applications.png
+icons48dir = $(datadir)/icons/hicolor/48x48/apps
+dist_icons48_DATA = icons/48x48/gnome-settings-default-applications.png
+
+gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
+uninstall-hook: update-icon-cache
+install-data-hook: update-icon-cache
+update-icon-cache:
+ @-if test -z "$(DESTDIR)"; then \
+ echo "Updating Gtk icon cache."; \
+ $(gtk_update_icon_cache); \
+ else \
+ echo "*** Icon cache not updated. After install, run this:"; \
+ echo "*** $(gtk_update_icon_cache)"; \
+ fi
+
+
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA) $(xmldata_DATA) $(autostart_DATA) $(bin_SCRIPTS)
EXTRA_DIST = $(xmldata_in_files)
Modified: branches/randr-12/capplets/default-applications/gnome-da-capplet.c
==============================================================================
--- branches/randr-12/capplets/default-applications/gnome-da-capplet.c (original)
+++ branches/randr-12/capplets/default-applications/gnome-da-capplet.c Tue Jun 17 23:18:22 2008
@@ -2,6 +2,7 @@
* Authors: Luca Cavalli <loopback slackit org>
*
* Copyright 2005-2006 Luca Cavalli
+ * Copyright 2008 Thomas Wood <thos gnome org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License
@@ -26,13 +27,12 @@
#include <gnome.h>
#include <glib/gi18n.h>
+#include "gconf-property-editor.h"
#include "gnome-da-capplet.h"
#include "gnome-da-xml.h"
#include "gnome-da-item.h"
#include "capplet-util.h"
-/* TODO: it doesn't use GConfPropertyEditor, use it when/if moved to control-center */
-
enum
{
PIXBUF_COL,
@@ -52,89 +52,6 @@
}
}
-static gboolean
-entry_focus_out_event_cb (GtkWidget *widget, GdkEventFocus *event, GnomeDACapplet *capplet)
-{
- const gchar *text;
- GError *error = NULL;
-
- text = gtk_entry_get_text (GTK_ENTRY (widget));
-
- if (widget == capplet->web_browser_command_entry) {
- gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_HTTP_EXEC, text, &error);
- }
- else if (widget == capplet->mail_reader_command_entry) {
- gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_MAILER_EXEC, text, &error);
- }
- else if (widget == capplet->terminal_command_entry) {
- gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC, text, &error);
- }
- else if (widget == capplet->terminal_exec_flag_entry) {
- gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, text, &error);
- }
- else if (widget == capplet->media_player_command_entry) {
- gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_EXEC, text, &error);
- }
-
- if (error != NULL) {
- g_warning (_("Error saving configuration: %s"), error->message);
- g_error_free (error);
- }
- else if (widget == capplet->visual_command_entry) {
- gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_EXEC, text, NULL);
- }
- else if (widget == capplet->mobility_command_entry) {
- gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_EXEC, text, NULL);
- }
-
- return FALSE;
-}
-
-static void
-terminal_checkbutton_toggled_cb (GtkWidget *togglebutton, GnomeDACapplet *capplet)
-{
- gboolean is_active;
- GError *error = NULL;
-
- is_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton));
-
- if (togglebutton == capplet->web_browser_terminal_checkbutton) {
- gconf_client_set_bool (capplet->gconf, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, is_active, &error);
- }
- else if (togglebutton == capplet->mail_reader_terminal_checkbutton) {
- gconf_client_set_bool (capplet->gconf, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, is_active, &error);
- }
- else if (togglebutton == capplet->media_player_terminal_checkbutton) {
- gconf_client_set_bool (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM, is_active, &error);
- }
-
- if (error != NULL) {
- g_warning (_("Error saving configuration: %s"), error->message);
- g_error_free (error);
- }
-}
-
-static void
-a11y_checkbutton_toggled_cb (GtkWidget *togglebutton, GnomeDACapplet *capplet)
-{
- gboolean is_active;
- GError *error = NULL;
-
- is_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton));
-
- if (togglebutton == capplet->visual_startup_checkbutton) {
- gconf_client_set_bool (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_STARTUP, is_active, &error);
- }
- else if (togglebutton == capplet->mobility_startup_checkbutton) {
- gconf_client_set_bool (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_STARTUP, is_active, &error);
- }
-
- if (error != NULL) {
- g_warning (_("Error saving configuration: %s"), error->message);
- g_error_free (error);
- }
-}
-
static void
set_icon (GtkImage *image, GtkIconTheme *theme, const char *name)
{
@@ -182,61 +99,24 @@
static void
web_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
{
- GtkTreeIter iter;
- GtkTreePath *path;
guint current_index;
gboolean is_custom_active;
gboolean has_net_remote;
GnomeDAWebItem *item;
- GConfChangeSet *cs;
- GError *error = NULL;
- char *http_cmd;
- gtk_combo_box_get_active_iter (combo, &iter);
- path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo), &iter);
- current_index = gtk_tree_path_get_indices (path)[0];
- gtk_tree_path_free (path);
+ current_index = gtk_combo_box_get_active (combo);
if (current_index < g_list_length (capplet->web_browsers)) {
- gchar *command;
item = (GnomeDAWebItem*) g_list_nth_data (capplet->web_browsers, current_index);
has_net_remote = item->netscape_remote;
is_custom_active = FALSE;
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton)) && has_net_remote == TRUE)
- command = item->win_command;
- else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton)) && has_net_remote == TRUE)
- command = item->tab_command;
- else
- command = item->generic.command;
-
- cs = gconf_change_set_new ();
-
- gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_HTTP_EXEC, command);
- gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, item->run_in_terminal);
-
- gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
-
- if (error != NULL) {
- g_warning (_("Error saving configuration: %s"), error->message);
- g_error_free (error);
- }
-
- gconf_change_set_unref (cs);
}
else {
- has_net_remote = FALSE;
- is_custom_active = TRUE;
+ has_net_remote = FALSE;
+ is_custom_active = TRUE;
}
-
- http_cmd = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_HTTP_EXEC, NULL);
- gtk_entry_set_text (GTK_ENTRY (capplet->web_browser_command_entry),
- http_cmd ? http_cmd : "");
- g_free (http_cmd);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->web_browser_terminal_checkbutton),
- gconf_client_get_bool (capplet->gconf, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, NULL));
-
gtk_widget_set_sensitive (capplet->default_radiobutton, has_net_remote);
gtk_widget_set_sensitive (capplet->new_win_radiobutton, has_net_remote);
gtk_widget_set_sensitive (capplet->new_tab_radiobutton, has_net_remote);
@@ -250,48 +130,11 @@
static void
mail_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
{
- GtkTreeIter iter;
- GtkTreePath *path;
guint current_index;
gboolean is_custom_active;
- GnomeDASimpleItem *item;
- GConfChangeSet *cs;
- GError *error = NULL;
- char *mailer_cmd;
-
- gtk_combo_box_get_active_iter (combo, &iter);
- path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo), &iter);
- current_index = gtk_tree_path_get_indices (path)[0];
- gtk_tree_path_free (path);
-
- if (current_index < g_list_length (capplet->mail_readers)) {
- item = (GnomeDASimpleItem*) g_list_nth_data (capplet->mail_readers, current_index);
- is_custom_active = FALSE;
-
- cs = gconf_change_set_new ();
-
- gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_MAILER_EXEC, item->generic.command);
- gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, item->run_in_terminal);
-
- gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
-
- if (error != NULL) {
- g_warning (_("Error saving configuration: %s"), error->message);
- g_error_free (error);
- }
-
- gconf_change_set_unref (cs);
- }
- else {
- is_custom_active = TRUE;
- }
- mailer_cmd = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_MAILER_EXEC, NULL);
- gtk_entry_set_text (GTK_ENTRY (capplet->mail_reader_command_entry),
- mailer_cmd ? mailer_cmd : "");
- g_free (mailer_cmd);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mail_reader_terminal_checkbutton),
- gconf_client_get_bool (capplet->gconf, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, NULL));
+ current_index = gtk_combo_box_get_active (combo);
+ is_custom_active = (current_index >= g_list_length (capplet->mail_readers));
gtk_widget_set_sensitive (capplet->mail_reader_command_entry, is_custom_active);
gtk_widget_set_sensitive (capplet->mail_reader_command_label, is_custom_active);
@@ -301,48 +144,11 @@
static void
media_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
{
- GtkTreeIter iter;
- GtkTreePath *path;
guint current_index;
gboolean is_custom_active;
- GnomeDASimpleItem *item;
- GConfChangeSet *cs;
- GError *error = NULL;
- char *media_cmd;
-
- gtk_combo_box_get_active_iter (combo, &iter);
- path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo), &iter);
- current_index = gtk_tree_path_get_indices (path)[0];
- gtk_tree_path_free (path);
-
- if (current_index < g_list_length (capplet->media_players)) {
- item = (GnomeDASimpleItem *) g_list_nth_data (capplet->media_players, current_index);
- is_custom_active = FALSE;
-
- cs = gconf_change_set_new ();
-
- gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_MEDIA_EXEC, item->generic.command);
- gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM, item->run_in_terminal);
- gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
-
- if (error != NULL) {
- g_warning (_("Error saving configuration: %s"), error->message);
- g_error_free (error);
- }
-
- gconf_change_set_unref (cs);
- }
- else {
- is_custom_active = TRUE;
- }
-
- media_cmd = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_EXEC, NULL);
- gtk_entry_set_text (GTK_ENTRY (capplet->media_player_command_entry),
- media_cmd ? media_cmd : "");
- g_free (media_cmd);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->media_player_terminal_checkbutton),
- gconf_client_get_bool (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM, NULL));
+ current_index = gtk_combo_box_get_active (combo);
+ is_custom_active = (current_index >= g_list_length (capplet->media_players));
gtk_widget_set_sensitive (capplet->media_player_command_entry, is_custom_active);
gtk_widget_set_sensitive (capplet->media_player_command_label, is_custom_active);
@@ -352,49 +158,11 @@
static void
terminal_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
{
- GtkTreeIter iter;
- GtkTreePath *path;
guint current_index;
gboolean is_custom_active;
- GnomeDATermItem *item;
- GConfChangeSet *cs;
- GError *error = NULL;
- char *terminal_cmd, *terminal_cmd_arg;
-
- gtk_combo_box_get_active_iter (combo, &iter);
- path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo), &iter);
- current_index = gtk_tree_path_get_indices (path)[0];
- gtk_tree_path_free (path);
-
- if (current_index < g_list_length (capplet->terminals)) {
- item = (GnomeDATermItem*) g_list_nth_data (capplet->terminals, current_index);
- is_custom_active = FALSE;
-
- cs = gconf_change_set_new ();
-
- gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_TERMINAL_EXEC, item->generic.command);
- gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, item->exec_flag);
-
- gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
-
- if (error != NULL) {
- g_warning (_("Error saving configuration: %s"), error->message);
- g_error_free (error);
- }
- gconf_change_set_unref (cs);
- }
- else {
- is_custom_active = TRUE;
- }
- terminal_cmd = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC, NULL);
- terminal_cmd_arg = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, NULL);
- gtk_entry_set_text (GTK_ENTRY (capplet->terminal_command_entry),
- terminal_cmd ? terminal_cmd : "");
- gtk_entry_set_text (GTK_ENTRY (capplet->terminal_exec_flag_entry),
- terminal_cmd_arg ? terminal_cmd_arg : "");
- g_free (terminal_cmd);
- g_free (terminal_cmd_arg);
+ current_index = gtk_combo_box_get_active (combo);
+ is_custom_active = (current_index >= g_list_length (capplet->terminals));
gtk_widget_set_sensitive (capplet->terminal_command_entry, is_custom_active);
gtk_widget_set_sensitive (capplet->terminal_command_label, is_custom_active);
@@ -405,97 +173,24 @@
static void
visual_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
{
- GtkTreeIter iter;
- GtkTreePath *path;
guint current_index;
gboolean is_custom_active;
- GnomeDAVisualItem *item;
- GConfChangeSet *cs;
- GError *error = NULL;
- gchar *cmd;
-
- gtk_combo_box_get_active_iter (combo, &iter);
- path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo), &iter);
- current_index = gtk_tree_path_get_indices (path)[0];
- gtk_tree_path_free (path);
-
- if (current_index < g_list_length (capplet->visual_ats)) {
- item = (GnomeDAVisualItem *) g_list_nth_data (capplet->visual_ats, current_index);
- is_custom_active = FALSE;
-
- cs = gconf_change_set_new ();
-
- gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_VISUAL_EXEC, item->generic.command);
- gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_VISUAL_STARTUP, item->run_at_startup);
- gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
-
- if (error != NULL) {
- g_warning (_("Error saving configuration: %s"), error->message);
- g_error_free (error);
- }
-
- gconf_change_set_unref (cs);
- }
- else {
- is_custom_active = TRUE;
- }
-
- cmd = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_EXEC, NULL);
- gtk_entry_set_text (GTK_ENTRY (capplet->visual_command_entry), cmd ? cmd : "");
- g_free (cmd);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->visual_startup_checkbutton),
- gconf_client_get_bool (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_STARTUP, NULL));
+ current_index = gtk_combo_box_get_active (combo);
+ is_custom_active = (current_index >= g_list_length (capplet->visual_ats));
gtk_widget_set_sensitive (capplet->visual_command_entry, is_custom_active);
gtk_widget_set_sensitive (capplet->visual_command_label, is_custom_active);
-
}
static void
mobility_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
{
- GtkTreeIter iter;
- GtkTreePath *path;
guint current_index;
gboolean is_custom_active;
- GnomeDAMobilityItem *item;
- GConfChangeSet *cs;
- GError *error = NULL;
- gchar *cmd;
-
- gtk_combo_box_get_active_iter (combo, &iter);
- path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo), &iter);
- current_index = gtk_tree_path_get_indices (path)[0];
- gtk_tree_path_free (path);
-
- if (current_index < g_list_length (capplet->mobility_ats)) {
- item = (GnomeDAMobilityItem *) g_list_nth_data (capplet->mobility_ats, current_index);
- is_custom_active = FALSE;
-
- cs = gconf_change_set_new ();
- gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_MOBILITY_EXEC, item->generic.command);
- gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_MOBILITY_STARTUP, item->run_at_startup);
-
- gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
-
- if (error != NULL) {
- g_warning (_("Error saving configuration: %s"), error->message);
- g_error_free (error);
- }
-
- gconf_change_set_unref (cs);
- }
- else {
- is_custom_active = TRUE;
- }
-
- cmd = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_EXEC, NULL);
- gtk_entry_set_text (GTK_ENTRY (capplet->mobility_command_entry), cmd ? cmd : "");
- g_free (cmd);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mobility_startup_checkbutton),
- gconf_client_get_bool (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_STARTUP, NULL));
+ current_index = gtk_combo_box_get_active (combo);
+ is_custom_active = (current_index >= g_list_length (capplet->mobility_ats));
gtk_widget_set_sensitive (capplet->mobility_command_entry, is_custom_active);
gtk_widget_set_sensitive (capplet->mobility_command_label, is_custom_active);
@@ -607,247 +302,20 @@
}
static void
-web_browser_update_combo_box (GnomeDACapplet *capplet, const gchar *command)
-{
- GList *entry;
- gint index;
- gboolean is_custom_active;
-
- entry = g_list_find_custom (capplet->web_browsers, command, (GCompareFunc) web_item_comp);
-
- if (entry) {
- index = g_list_position (capplet->web_browsers, entry);
- is_custom_active = FALSE;
- }
- else {
- /* index of 'Custom' combo box entry */
- index = g_list_length (capplet->web_browsers) + 1;
- is_custom_active = TRUE;
- }
-
- /* TODO: Remove when GConfPropertyEditor will be used */
- gtk_entry_set_text (GTK_ENTRY (capplet->web_browser_command_entry), command);
-
- gtk_widget_set_sensitive (capplet->web_browser_command_entry, is_custom_active);
- gtk_widget_set_sensitive (capplet->web_browser_command_label, is_custom_active);
- gtk_widget_set_sensitive (capplet->web_browser_terminal_checkbutton, is_custom_active);
-
- if (gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->web_combo_box)) != index)
- gtk_combo_box_set_active (GTK_COMBO_BOX (capplet->web_combo_box), index);
-}
-
-static void
-web_browser_update_radio_buttons (GnomeDACapplet *capplet, const gchar *command)
-{
- GList *entry;
- gboolean has_net_remote;
-
- entry = g_list_find_custom (capplet->web_browsers, command, (GCompareFunc) web_item_comp);
-
- if (entry) {
- GnomeDAWebItem *item = (GnomeDAWebItem *) entry->data;
-
- has_net_remote = item->netscape_remote;
-
- if (has_net_remote) {
- /* disable "toggle" signal emitting, thus preventing calling this function twice */
- g_signal_handlers_block_matched (capplet->default_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
- 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
- g_signal_handlers_block_matched (capplet->new_tab_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
- 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
- g_signal_handlers_block_matched (capplet->new_win_radiobutton,G_SIGNAL_MATCH_FUNC, 0,
- 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->default_radiobutton),
- strcmp (item->generic.command, command) == 0);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton),
- strcmp (item->tab_command, command) == 0);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton),
- strcmp (item->win_command, command) == 0);
-
- g_signal_handlers_unblock_matched (capplet->default_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
- 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
- g_signal_handlers_unblock_matched (capplet->new_tab_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
- 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
- g_signal_handlers_unblock_matched (capplet->new_win_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
- 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
- }
- }
- else {
- has_net_remote = FALSE;
- }
-
- gtk_widget_set_sensitive (capplet->default_radiobutton, has_net_remote);
- gtk_widget_set_sensitive (capplet->new_win_radiobutton, has_net_remote);
- gtk_widget_set_sensitive (capplet->new_tab_radiobutton, has_net_remote);
-}
-
-/* FIXME: Refactor these two functions below into single one... */
-static void
-mail_reader_update_combo_box (GnomeDACapplet *capplet, const gchar *command)
-{
- GList *entry;
- gint index;
- gboolean is_custom_active;
-
- entry = g_list_find_custom (capplet->mail_readers, command, (GCompareFunc) generic_item_comp);
-
- if (entry) {
- index = g_list_position (capplet->mail_readers, entry);
- is_custom_active = FALSE;
- }
- else {
- /* index of 'Custom' combo box entry */
- index = g_list_length (capplet->mail_readers) + 1;
- is_custom_active = TRUE;
- }
-
- gtk_entry_set_text (GTK_ENTRY (capplet->mail_reader_command_entry), command);
-
- gtk_widget_set_sensitive (capplet->mail_reader_command_entry, is_custom_active);
- gtk_widget_set_sensitive (capplet->mail_reader_command_label, is_custom_active);
- gtk_widget_set_sensitive (capplet->mail_reader_terminal_checkbutton, is_custom_active);
-
- if (gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->mail_combo_box)) != index)
- gtk_combo_box_set_active (GTK_COMBO_BOX (capplet->mail_combo_box), index);
-}
-
-static void
-media_player_update_combo_box (GnomeDACapplet *capplet, const gchar *command)
-{
- GList *entry;
- gint index;
- gboolean is_custom_active;
-
- entry = g_list_find_custom (capplet->media_players, command, (GCompareFunc) generic_item_comp);
-
- if (entry) {
- index = g_list_position (capplet->media_players, entry);
- is_custom_active = FALSE;
- }
- else {
- /* index of 'Custom' combo box entry */
- index = g_list_length (capplet->media_players) + 1;
- is_custom_active = TRUE;
- }
-
- gtk_entry_set_text (GTK_ENTRY (capplet->media_player_command_entry), command);
-
- gtk_widget_set_sensitive (capplet->media_player_command_entry, is_custom_active);
- gtk_widget_set_sensitive (capplet->media_player_command_label, is_custom_active);
- gtk_widget_set_sensitive (capplet->media_player_terminal_checkbutton, is_custom_active);
-
- if (gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->media_combo_box)) != index)
- gtk_combo_box_set_active (GTK_COMBO_BOX (capplet->media_combo_box), index);
-}
-
-static void
-terminal_update_combo_box (GnomeDACapplet *capplet, const gchar *command)
-{
- GList *entry;
- gint index;
- gboolean is_custom_active;
-
- entry = g_list_find_custom (capplet->terminals, command, (GCompareFunc) generic_item_comp);
-
- if (entry) {
- index = g_list_position (capplet->terminals, entry);
- is_custom_active = FALSE;
- }
- else {
- /* index of 'Custom' combo box entry */
- index = g_list_length (capplet->terminals) + 1;
- is_custom_active = TRUE;
- }
-
- gtk_entry_set_text (GTK_ENTRY (capplet->terminal_command_entry), command);
-
- gtk_widget_set_sensitive (capplet->terminal_command_entry, is_custom_active);
- gtk_widget_set_sensitive (capplet->terminal_command_label, is_custom_active);
- gtk_widget_set_sensitive (capplet->terminal_exec_flag_entry, is_custom_active);
- gtk_widget_set_sensitive (capplet->terminal_exec_flag_label, is_custom_active);
-
- if (gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->term_combo_box)) != index)
- gtk_combo_box_set_active (GTK_COMBO_BOX (capplet->term_combo_box), index);
-}
-
-static void
-visual_update_combo_box (GnomeDACapplet *capplet, const gchar *command)
-{
- GList *entry;
- gint index;
- gboolean is_custom_active;
-
- entry = g_list_find_custom (capplet->visual_ats, command, (GCompareFunc) generic_item_comp);
-
- if (entry) {
- index = g_list_position (capplet->visual_ats, entry);
- is_custom_active = FALSE;
- }
- else {
- /* index of 'Custom' combo box entry */
- index = g_list_length (capplet->visual_ats) + 1;
- is_custom_active = TRUE;
- }
-
- gtk_entry_set_text (GTK_ENTRY (capplet->visual_command_entry), command);
-
- gtk_widget_set_sensitive (capplet->visual_command_entry, is_custom_active);
- gtk_widget_set_sensitive (capplet->visual_command_label, is_custom_active);
-
- if (gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->visual_combo_box)) != index)
- gtk_combo_box_set_active (GTK_COMBO_BOX (capplet->visual_combo_box), index);
-}
-
-
-static void
-mobility_update_combo_box (GnomeDACapplet *capplet, const gchar *command)
-{
- GList *entry;
- gint index;
- gboolean is_custom_active;
-
- entry = g_list_find_custom (capplet->mobility_ats, command, (GCompareFunc) generic_item_comp);
-
- if (entry) {
- index = g_list_position (capplet->mobility_ats, entry);
- is_custom_active = FALSE;
- }
- else {
- /* index of 'Custom' combo box entry */
- index = g_list_length (capplet->mobility_ats) + 1;
- is_custom_active = TRUE;
- }
-
- gtk_entry_set_text (GTK_ENTRY (capplet->mobility_command_entry), command);
-
- gtk_widget_set_sensitive (capplet->mobility_command_entry, is_custom_active);
- gtk_widget_set_sensitive (capplet->mobility_command_label, is_custom_active);
-
- if (gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->mobility_combo_box)) != index)
- gtk_combo_box_set_active (GTK_COMBO_BOX (capplet->mobility_combo_box), index);
-}
-
-static void
-web_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet)
+web_gconf_changed_cb (GConfPropertyEditor *peditor, gchar *key, GConfValue *value, GnomeDACapplet *capplet)
{
- GConfValue *value;
GConfChangeSet *cs;
GError *error = NULL;
GList *list_entry;
- g_return_if_fail (gconf_entry_get_key (entry) != NULL);
-
- if (!(value = gconf_entry_get_value (entry)))
- return;
+ /* This function is used to update HTTPS,ABOUT and UNKNOWN handlers, which
+ * should also use the same value as HTTP
+ */
- if (strcmp (entry->key, DEFAULT_APPS_KEY_HTTP_EXEC) == 0) {
+ if (strcmp (key, DEFAULT_APPS_KEY_HTTP_EXEC) == 0) {
gchar *short_browser, *pos;
const gchar *value_str = gconf_value_get_string (value);
- web_browser_update_combo_box (capplet, value_str);
- web_browser_update_radio_buttons (capplet, value_str);
-
cs = gconf_change_set_new ();
gconf_change_set_set (cs, DEFAULT_APPS_KEY_HTTPS_EXEC, value);
@@ -881,8 +349,7 @@
gconf_change_set_unref (cs);
}
- /* TODO: Remove when GConfPropertyEditor will be used */
- else if (strcmp (entry->key, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM) == 0) {
+ else if (strcmp (key, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM) == 0) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->web_browser_terminal_checkbutton),
gconf_value_get_bool (value));
@@ -905,105 +372,188 @@
}
}
-/* FIXME: Refactor these two functions below into single one... */
static void
-mail_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet)
+web_browser_update_radio_buttons (GnomeDACapplet *capplet, const gchar *command)
{
- GConfValue *value;
+ GList *entry;
+ gboolean has_net_remote;
- g_return_if_fail (gconf_entry_get_key (entry) != NULL);
+ entry = g_list_find_custom (capplet->web_browsers, command, (GCompareFunc) web_item_comp);
- if (!(value = gconf_entry_get_value (entry)))
- return;
+ if (entry) {
+ GnomeDAWebItem *item = (GnomeDAWebItem *) entry->data;
+
+ has_net_remote = item->netscape_remote;
+
+ if (has_net_remote) {
+ /* disable "toggle" signal emitting, thus preventing calling this function twice */
+ g_signal_handlers_block_matched (capplet->default_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
+ 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
+ g_signal_handlers_block_matched (capplet->new_tab_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
+ 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
+ g_signal_handlers_block_matched (capplet->new_win_radiobutton,G_SIGNAL_MATCH_FUNC, 0,
+ 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
- if (strcmp (entry->key, DEFAULT_APPS_KEY_MAILER_EXEC) == 0) {
- mail_reader_update_combo_box (capplet, gconf_value_get_string (value));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->default_radiobutton),
+ strcmp (item->generic.command, command) == 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton),
+ strcmp (item->tab_command, command) == 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton),
+ strcmp (item->win_command, command) == 0);
+
+ g_signal_handlers_unblock_matched (capplet->default_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
+ 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
+ g_signal_handlers_unblock_matched (capplet->new_tab_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
+ 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
+ g_signal_handlers_unblock_matched (capplet->new_win_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
+ 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
+ }
}
- /* TODO: Remove when GConfPropertyEditor will be used */
- else if (strcmp (entry->key, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM) == 0) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mail_reader_terminal_checkbutton),
- gconf_value_get_bool (value));
+ else {
+ has_net_remote = FALSE;
}
+
+ gtk_widget_set_sensitive (capplet->default_radiobutton, has_net_remote);
+ gtk_widget_set_sensitive (capplet->new_win_radiobutton, has_net_remote);
+ gtk_widget_set_sensitive (capplet->new_tab_radiobutton, has_net_remote);
}
-static void
-media_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet)
+static GConfValue*
+web_combo_conv_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
- GConfValue *value;
+ GConfValue *ret;
+ GList *entry, *handlers;
+ const gchar *command;
+ gint index;
+ GnomeDACapplet *capplet;
- g_return_if_fail (gconf_entry_get_key (entry) != NULL);
+ g_object_get (G_OBJECT (peditor), "data", &capplet, NULL);
- if (!(value = gconf_entry_get_value (entry)))
- return;
+ command = gconf_value_get_string (value);
+ handlers = capplet->web_browsers;
- if (strcmp (entry->key, DEFAULT_APPS_KEY_MEDIA_EXEC) == 0) {
- media_player_update_combo_box (capplet, gconf_value_get_string (value));
+ if (handlers)
+ {
+ entry = g_list_find_custom (handlers, command, (GCompareFunc) web_item_comp);
+ if (entry)
+ index = g_list_position (handlers, entry);
+ else
+ index = g_list_length (handlers) + 1;
}
- /* TODO: Remove when GConfPropertyEditor will be used */
- else if (strcmp (entry->key, DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM) == 0) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->media_player_terminal_checkbutton),
- gconf_value_get_bool (value));
+ else
+ {
+ /* if the item has no handlers lsit then select the Custom item */
+ index = 1;
}
+
+ web_browser_update_radio_buttons (capplet, command);
+
+ ret = gconf_value_new (GCONF_VALUE_INT);
+ gconf_value_set_int (ret, index);
+ return ret;
}
-static void
-term_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet)
+static GConfValue*
+web_combo_conv_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
- GConfValue *value;
+ GConfValue *ret;
+ GList *handlers;
+ gint index;
+ GnomeDAWebItem *item;
+ const gchar *command;
+ GnomeDACapplet *capplet;
- g_return_if_fail (gconf_entry_get_key (entry) != NULL);
+ g_object_get (G_OBJECT (peditor), "data", &capplet, NULL);
- if (!(value = gconf_entry_get_value (entry)))
- return;
+ index = gconf_value_get_int (value);
+ handlers = capplet->web_browsers;
+
+ item = g_list_nth_data (handlers, index);
+
+ ret = gconf_value_new (GCONF_VALUE_STRING);
+ if (!item)
+ {
+ /* if item was not found, this is probably the "Custom" item */
- if (strcmp (entry->key, DEFAULT_APPS_KEY_TERMINAL_EXEC) == 0) {
- terminal_update_combo_box (capplet, gconf_value_get_string (value));
+ /* XXX: returning "" as the value here is not ideal, but required to
+ * prevent the combo box from jumping back to the previous value if the
+ * user has selected Custom */
+ gconf_value_set_string (ret, "");
+ return ret;
}
- /* TODO: Remove when GConfPropertyEditor will be used */
- else if (strcmp (entry->key, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG) == 0) {
- gtk_entry_set_text (GTK_ENTRY (capplet->terminal_exec_flag_entry),
- gconf_value_get_string (value));
+ else
+ {
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton)) && item->netscape_remote == TRUE)
+ command = item->win_command;
+ else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton)) && item->netscape_remote == TRUE)
+ command = item->tab_command;
+ else
+ command = item->generic.command;
+
+ gconf_value_set_string (ret, command);
+ return ret;
}
}
-
-static void
-visual_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet)
+static GConfValue*
+combo_conv_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
- GConfValue *value;
+ GConfValue *ret;
+ GList *entry, *handlers;
+ const gchar *command;
+ gint index;
- g_return_if_fail (gconf_entry_get_key (entry) != NULL);
+ g_object_get (G_OBJECT (peditor), "data", &handlers, NULL);
- if (!(value = gconf_entry_get_value (entry)))
- return;
+ command = gconf_value_get_string (value);
- if (strcmp (entry->key, DEFAULT_APPS_KEY_VISUAL_EXEC) == 0) {
- visual_update_combo_box (capplet, gconf_value_get_string (value));
+ if (handlers)
+ {
+ entry = g_list_find_custom (handlers, command, (GCompareFunc) generic_item_comp);
+ if (entry)
+ index = g_list_position (handlers, entry);
+ else
+ index = g_list_length (handlers) + 1;
}
- /* TODO: Remove when GConfPropertyEditor will be used */
- else if (strcmp (entry->key, DEFAULT_APPS_KEY_VISUAL_STARTUP) == 0) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->visual_startup_checkbutton),
- gconf_value_get_bool (value));
+ else
+ {
+ /* if the item has no handlers lsit then select the Custom item */
+ index = 1;
}
+
+ ret = gconf_value_new (GCONF_VALUE_INT);
+ gconf_value_set_int (ret, index);
+ return ret;
}
-static void
-mobility_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet)
+static GConfValue*
+combo_conv_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
- GConfValue *value;
+ GConfValue *ret;
+ GList *handlers;
+ gint index;
+ GnomeDAItem *item;
- g_return_if_fail (gconf_entry_get_key (entry) != NULL);
+ g_object_get (G_OBJECT (peditor), "data", &handlers, NULL);
+ index = gconf_value_get_int (value);
- if (!(value = gconf_entry_get_value (entry)))
- return;
+ item = g_list_nth_data (handlers, index);
+ ret = gconf_value_new (GCONF_VALUE_STRING);
- if (strcmp (entry->key, DEFAULT_APPS_KEY_MOBILITY_EXEC) == 0) {
- mobility_update_combo_box (capplet, gconf_value_get_string (value));
+ if (!item)
+ {
+ /* if item was not found, this is probably the "Custom" item */
+
+ /* XXX: returning "" as the value here is not ideal, but required to
+ * prevent the combo box from jumping back to the previous value if the
+ * user has selected Custom */
+ gconf_value_set_string (ret, "");
+ return NULL;
}
- /* TODO: Remove when GConfPropertyEditor will be used */
- else if (strcmp (entry->key, DEFAULT_APPS_KEY_MOBILITY_STARTUP) == 0) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mobility_startup_checkbutton),
- gconf_value_get_bool (value));
+ else
+ {
+ gconf_value_set_string (ret, item->command);
+ return ret;
}
}
@@ -1084,7 +634,7 @@
static void
show_dialog (GnomeDACapplet *capplet, const gchar *start_page)
{
- GConfValue *value;
+ GObject *obj;
if (g_file_test (GNOMECC_GLADE_DIR "/gnome-default-applications-properties.glade", G_FILE_TEST_EXISTS) != FALSE) {
capplet->xml = glade_xml_new (GNOMECC_GLADE_DIR "/gnome-default-applications-properties.glade", NULL, NULL);
@@ -1155,104 +705,6 @@
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats);
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats);
- /* update ui to gconf content */
- value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_HTTP_EXEC, NULL);
- if (value)
- {
- web_browser_update_combo_box (capplet, gconf_value_get_string (value));
- web_browser_update_radio_buttons (capplet, gconf_value_get_string (value));
- gconf_value_free (value);
- }
-
- value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, NULL);
- if (value)
- {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->web_browser_terminal_checkbutton),
- gconf_value_get_bool (value));
- gconf_value_free (value);
- }
-
- value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MAILER_EXEC, NULL);
- if (value)
- {
- mail_reader_update_combo_box (capplet, gconf_value_get_string (value));
- gconf_value_free (value);
- }
-
- value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, NULL);
- if (value)
- {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mail_reader_terminal_checkbutton),
- gconf_value_get_bool (value));
- gconf_value_free (value);
- }
-
- value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC, NULL);
- if (value)
- {
- terminal_update_combo_box (capplet, gconf_value_get_string (value));
- gconf_value_free (value);
- }
-
- value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, NULL);
- if (value)
- {
- gtk_entry_set_text (GTK_ENTRY (capplet->terminal_exec_flag_entry),
- gconf_value_get_string (value));
- gconf_value_free (value);
- }
-
- value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_EXEC, NULL);
- if (value)
- {
- media_player_update_combo_box (capplet, gconf_value_get_string (value));
- gconf_value_free (value);
- }
-
- value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM, NULL);
- if (value)
- {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->media_player_terminal_checkbutton),
- gconf_value_get_bool (value));
- gconf_value_free (value);
- }
-
- value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_EXEC, NULL);
-
- if (value)
- {
- visual_update_combo_box (capplet, gconf_value_get_string (value));
- gconf_value_free (value);
- }
-
- value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_STARTUP, NULL);
-
- if (value)
- {
- gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON (capplet->visual_startup_checkbutton),
- gconf_value_get_bool (value));
- gconf_value_free (value);
- }
-
- value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_EXEC, NULL);
-
- if (value)
- {
- mobility_update_combo_box (capplet, gconf_value_get_string (value));
- gconf_value_free (value);
- }
-
- value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_STARTUP, NULL);
-
- if (value)
- {
- gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON (capplet->mobility_startup_checkbutton),
- gconf_value_get_bool (value));
- gconf_value_free (value);
- }
-
g_signal_connect (capplet->web_combo_box, "changed", G_CALLBACK (web_combo_changed_cb), capplet);
g_signal_connect (capplet->mail_combo_box, "changed", G_CALLBACK (mail_combo_changed_cb), capplet);
g_signal_connect (capplet->term_combo_box, "changed", G_CALLBACK (terminal_combo_changed_cb), capplet);
@@ -1260,31 +712,130 @@
g_signal_connect (capplet->visual_combo_box, "changed", G_CALLBACK (visual_combo_changed_cb), capplet);
g_signal_connect (capplet->mobility_combo_box, "changed", G_CALLBACK (mobility_combo_changed_cb), capplet);
- /* TODO: Remove when GConfPropertyEditor will be used */
- g_signal_connect (capplet->web_browser_terminal_checkbutton, "toggled",
- G_CALLBACK (terminal_checkbutton_toggled_cb), capplet);
- g_signal_connect (capplet->mail_reader_terminal_checkbutton, "toggled",
- G_CALLBACK (terminal_checkbutton_toggled_cb), capplet);
- g_signal_connect (capplet->media_player_terminal_checkbutton, "toggled",
- G_CALLBACK (terminal_checkbutton_toggled_cb), capplet);
- g_signal_connect (capplet->visual_startup_checkbutton, "toggled",
- G_CALLBACK (a11y_checkbutton_toggled_cb), capplet);
- g_signal_connect (capplet->mobility_startup_checkbutton, "toggled",
- G_CALLBACK (a11y_checkbutton_toggled_cb), capplet);
-
- /* TODO: Remove when GConfPropertyEditor will be used */
- g_signal_connect (capplet->web_browser_command_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet);
- g_signal_connect (capplet->mail_reader_command_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet);
- g_signal_connect (capplet->terminal_command_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet);
- g_signal_connect (capplet->terminal_exec_flag_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet);
- g_signal_connect (capplet->media_player_command_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet);
- g_signal_connect (capplet->visual_command_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet);
- g_signal_connect (capplet->mobility_command_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet);
g_signal_connect (capplet->default_radiobutton, "toggled", G_CALLBACK (web_radiobutton_toggled_cb), capplet);
g_signal_connect (capplet->new_win_radiobutton, "toggled", G_CALLBACK (web_radiobutton_toggled_cb), capplet);
g_signal_connect (capplet->new_tab_radiobutton, "toggled", G_CALLBACK (web_radiobutton_toggled_cb), capplet);
+ /* Setup GConfPropertyEditors */
+
+ /* Web Browser */
+ gconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_HTTP_EXEC,
+ capplet->web_combo_box,
+ "conv-from-widget-cb", web_combo_conv_from_widget,
+ "conv-to-widget-cb", web_combo_conv_to_widget,
+ "data", capplet,
+ NULL);
+
+ obj = gconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_HTTP_EXEC,
+ capplet->web_browser_command_entry,
+ NULL);
+ g_signal_connect (obj, "value-changed", G_CALLBACK (web_gconf_changed_cb), capplet);
+
+ obj = gconf_peditor_new_boolean (NULL,
+ DEFAULT_APPS_KEY_HTTP_NEEDS_TERM,
+ capplet->web_browser_terminal_checkbutton,
+ NULL);
+ g_signal_connect (obj, "value-changed", G_CALLBACK (web_gconf_changed_cb), capplet);
+
+ /* Mailer */
+ gconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_MAILER_EXEC,
+ capplet->mail_combo_box,
+ "conv-from-widget-cb", combo_conv_from_widget,
+ "conv-to-widget-cb", combo_conv_to_widget,
+ "data", capplet->mail_readers,
+ NULL);
+
+ gconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_MAILER_EXEC,
+ capplet->mail_reader_command_entry,
+ NULL);
+
+ gconf_peditor_new_boolean (NULL,
+ DEFAULT_APPS_KEY_MAILER_NEEDS_TERM,
+ capplet->mail_reader_terminal_checkbutton,
+ NULL);
+
+ /* Media player */
+ gconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_MEDIA_EXEC,
+ capplet->media_combo_box,
+ "conv-from-widget-cb", combo_conv_from_widget,
+ "conv-to-widget-cb", combo_conv_to_widget,
+ "data", capplet->media_players,
+ NULL);
+
+ gconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_MEDIA_EXEC,
+ capplet->media_player_command_entry,
+ NULL);
+
+ gconf_peditor_new_boolean (NULL,
+ DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM,
+ capplet->media_player_terminal_checkbutton,
+ NULL);
+
+ /* Terminal */
+ gconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_TERMINAL_EXEC,
+ capplet->term_combo_box,
+ "conv-from-widget-cb", combo_conv_from_widget,
+ "conv-to-widget-cb", combo_conv_to_widget,
+ "data", capplet->terminals,
+ NULL);
+
+ gconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_TERMINAL_EXEC,
+ capplet->terminal_command_entry,
+ NULL);
+ gconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG,
+ capplet->terminal_exec_flag_entry,
+ NULL);
+
+
+ /* Visual */
+ gconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_VISUAL_EXEC,
+ capplet->visual_combo_box,
+ "conv-from-widget-cb", combo_conv_from_widget,
+ "conv-to-widget-cb", combo_conv_to_widget,
+ "data", capplet->visual_ats,
+ NULL);
+
+ gconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_VISUAL_EXEC,
+ capplet->visual_command_entry,
+ NULL);
+
+ gconf_peditor_new_boolean (NULL,
+ DEFAULT_APPS_KEY_VISUAL_STARTUP,
+ capplet->visual_startup_checkbutton,
+ NULL);
+
+
+ /* Mobility */
+ gconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_MOBILITY_EXEC,
+ capplet->mobility_combo_box,
+ "conv-from-widget-cb", combo_conv_from_widget,
+ "conv-to-widget-cb", combo_conv_to_widget,
+ "data", capplet->mobility_ats,
+ NULL);
+
+ gconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_MOBILITY_EXEC,
+ capplet->mobility_command_entry,
+ NULL);
+
+ gconf_peditor_new_boolean (NULL,
+ DEFAULT_APPS_KEY_MOBILITY_STARTUP,
+ capplet->mobility_startup_checkbutton,
+ NULL);
+
gtk_window_set_icon_name (GTK_WINDOW (capplet->window),
"gnome-settings-default-applications");
@@ -1348,32 +899,6 @@
capplet = g_new0 (GnomeDACapplet, 1);
capplet->gconf = gconf_client_get_default ();
-
- gconf_client_add_dir (capplet->gconf, "/desktop/gnome/applications/browser", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- gconf_client_add_dir (capplet->gconf, "/desktop/gnome/applications/terminal", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- gconf_client_add_dir (capplet->gconf, "/desktop/gnome/applications/media", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- gconf_client_add_dir (capplet->gconf, "/desktop/gnome/url-handlers", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- gconf_client_add_dir (capplet->gconf, "/desktop/gnome/accessibility/at", GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
-
- gconf_client_notify_add (capplet->gconf, DEFAULT_APPS_KEY_HTTP_PATH,
- (GConfClientNotifyFunc) web_gconf_changed_cb,
- capplet, NULL, NULL);
- gconf_client_notify_add (capplet->gconf, DEFAULT_APPS_KEY_MAILER_PATH,
- (GConfClientNotifyFunc) mail_gconf_changed_cb,
- capplet, NULL, NULL);
- gconf_client_notify_add (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_PATH,
- (GConfClientNotifyFunc) term_gconf_changed_cb,
- capplet, NULL, NULL);
- gconf_client_notify_add (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_PATH,
- (GConfClientNotifyFunc) media_gconf_changed_cb,
- capplet, NULL, NULL);
- gconf_client_notify_add (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_PATH,
- (GConfClientNotifyFunc) visual_gconf_changed_cb,
- capplet, NULL, NULL);
- gconf_client_notify_add (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_PATH,
- (GConfClientNotifyFunc) mobility_gconf_changed_cb,
- capplet, NULL, NULL);
-
gnome_da_xml_load_list (capplet);
show_dialog (capplet, start_page);
Modified: branches/randr-12/capplets/keybindings/gnome-keybinding-properties.c
==============================================================================
--- branches/randr-12/capplets/keybindings/gnome-keybinding-properties.c (original)
+++ branches/randr-12/capplets/keybindings/gnome-keybinding-properties.c Tue Jun 17 23:18:22 2008
@@ -16,6 +16,7 @@
#include "eggcellrendererkeys.h"
#include "activate-settings-daemon.h"
+#define GCONF_BINDING_DIR "/desktop/gnome/keybindings"
#define MAX_ELEMENTS_BEFORE_SCROLLING 10
typedef struct {
@@ -40,6 +41,7 @@
char *name;
int value;
char *key;
+ char *description_name;
Comparison comparison;
} KeyListEntry;
@@ -58,8 +60,11 @@
EggVirtualModifierType mask;
gboolean editable;
GtkTreeModel *model;
- guint gconf_cnxn;
char *description;
+ char *desc_gconf_key;
+ gboolean desc_editable;
+ guint gconf_cnxn;
+ guint gconf_cnxn_desc;
} KeyEntry;
static gboolean block_accels = FALSE;
@@ -67,13 +72,8 @@
static GladeXML *
create_dialog (void)
{
- GladeXML *dialog;
-
- dialog = glade_xml_new (GNOMECC_GLADE_DIR "/gnome-keybinding-properties.glade", "gnome-keybinding-dialog", NULL);
- if (!dialog)
- dialog = glade_xml_new ("gnome-keybinding-properties.glade", "gnome-keybinding-dialog", NULL);
-
- return dialog;
+ return glade_xml_new (GNOMECC_GLADE_DIR "/gnome-keybinding-properties.glade",
+ "gnome-keybinding-dialog", NULL);
}
static char*
@@ -128,11 +128,11 @@
-1);
if (key_entry == NULL)
- g_object_set (G_OBJECT (cell),
+ g_object_set (cell,
"visible", FALSE,
NULL);
else if (! key_entry->editable)
- g_object_set (G_OBJECT (cell),
+ g_object_set (cell,
"visible", TRUE,
"editable", FALSE,
"accel_key", key_entry->keyval,
@@ -141,7 +141,7 @@
"style", PANGO_STYLE_ITALIC,
NULL);
else
- g_object_set (G_OBJECT (cell),
+ g_object_set (cell,
"visible", TRUE,
"editable", TRUE,
"accel_key", key_entry->keyval,
@@ -151,6 +151,27 @@
NULL);
}
+static void
+description_set_func (GtkTreeViewColumn *tree_column,
+ GtkCellRenderer *cell,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ KeyEntry *key_entry;
+
+ gtk_tree_model_get (model, iter,
+ KEYENTRY_COLUMN, &key_entry,
+ -1);
+
+ if (key_entry != NULL)
+ g_object_set (cell,
+ "editable", key_entry->desc_editable,
+ "text", key_entry->description != NULL ?
+ key_entry->description : _("<Unknown Action>"),
+ NULL);
+}
+
static gboolean
keybinding_key_changed_foreach (GtkTreeModel *model,
GtkTreePath *path,
@@ -182,8 +203,8 @@
KeyEntry *key_entry;
const gchar *key_value;
- key_entry = (KeyEntry *)user_data;
- key_value = gconf_value_get_string (entry->value);
+ key_entry = (KeyEntry *) user_data;
+ key_value = entry->value ? gconf_value_get_string (entry->value) : NULL;
binding_from_string (key_value, &key_entry->keyval, &key_entry->keycode, &key_entry->mask);
key_entry->editable = gconf_entry_get_is_writable (entry);
@@ -192,6 +213,26 @@
gtk_tree_model_foreach (key_entry->model, keybinding_key_changed_foreach, key_entry);
}
+static void
+keybinding_description_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ KeyEntry *key_entry;
+ const gchar *key_value;
+
+ key_entry = (KeyEntry *) user_data;
+ key_value = entry->value ? gconf_value_get_string (entry->value) : NULL;
+
+ g_free (key_entry->description);
+ key_entry->description = key_value ? g_strdup (key_value) : NULL;
+ key_entry->desc_editable = gconf_entry_get_is_writable (entry);
+
+ /* update the model */
+ gtk_tree_model_foreach (key_entry->model, keybinding_key_changed_foreach, key_entry);
+}
+
static int
keyentry_sort_func (GtkTreeModel *model,
GtkTreeIter *a,
@@ -297,9 +338,13 @@
if (key_entry != NULL)
{
+ gconf_client_remove_dir (client, key_entry->gconf_key, NULL);
gconf_client_notify_remove (client, key_entry->gconf_cnxn);
+ if (key_entry->gconf_cnxn_desc != 0)
+ gconf_client_notify_remove (client, key_entry->gconf_cnxn_desc);
g_free (key_entry->gconf_key);
g_free (key_entry->description);
+ g_free (key_entry->desc_gconf_key);
g_free (key_entry);
}
}
@@ -428,11 +473,10 @@
for (j = 0; keys_list[j].name != NULL; j++)
{
GConfEntry *entry;
- GConfSchema *schema = NULL;
KeyEntry *key_entry;
- GError *error = NULL;
const gchar *key_string;
gchar *key_value;
+ gchar *description;
if (!should_show_key (&keys_list[j]))
continue;
@@ -443,59 +487,71 @@
key_string,
NULL,
TRUE,
- &error);
- if (error || entry == NULL)
+ NULL);
+ if (entry == NULL)
{
/* We don't actually want to popup a dialog - just skip this one */
- if (error)
- g_error_free (error);
continue;
}
- if (gconf_entry_get_schema_name (entry))
- schema = gconf_client_get_schema (client, gconf_entry_get_schema_name (entry), &error);
+ if (keys_list[j].description_name != NULL)
+ {
+ description = gconf_client_get_string (client, keys_list[j].description_name, NULL);
+ }
+ else
+ {
+ description = NULL;
- if (error || schema == NULL)
- {
- /* We don't actually want to popup a dialog - just skip this one */
- if (error)
- g_error_free (error);
- continue;
- }
+ if (gconf_entry_get_schema_name (entry))
+ {
+ GConfSchema *schema;
- key_value = gconf_client_get_string (client, key_string, &error);
+ schema = gconf_client_get_schema (client,
+ gconf_entry_get_schema_name (entry),
+ NULL);
+ if (schema != NULL)
+ {
+ description = g_strdup (gconf_schema_get_short_desc (schema));
+ gconf_schema_free (schema);
+ }
+ }
+ }
key_entry = g_new0 (KeyEntry, 1);
key_entry->gconf_key = g_strdup (key_string);
key_entry->editable = gconf_entry_get_is_writable (entry);
key_entry->model = model;
+ key_entry->description = description;
+ if (keys_list[j].description_name != NULL)
+ {
+ key_entry->desc_gconf_key = g_strdup (keys_list[j].description_name);
+ key_entry->desc_editable = gconf_client_key_is_writable (client, key_entry->desc_gconf_key, NULL);
+ key_entry->gconf_cnxn_desc = gconf_client_notify_add (client,
+ key_entry->desc_gconf_key,
+ (GConfClientNotifyFunc) &keybinding_description_changed,
+ key_entry, NULL, NULL);
+ }
+
gconf_client_add_dir (client, key_string, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
key_entry->gconf_cnxn = gconf_client_notify_add (client,
key_string,
(GConfClientNotifyFunc) &keybinding_key_changed,
key_entry, NULL, NULL);
+
+ key_value = gconf_client_get_string (client, key_string, NULL);
binding_from_string (key_value, &key_entry->keyval, &key_entry->keycode, &key_entry->mask);
g_free (key_value);
- key_entry->description = g_strdup (gconf_schema_get_short_desc (schema));
+ gconf_entry_free (entry);
ensure_scrollbar (dialog, i);
- i++;
+ ++i;
gtk_tree_store_append (GTK_TREE_STORE (model), &iter, &parent_iter);
- if (gconf_schema_get_short_desc (schema))
- gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
- DESCRIPTION_COLUMN,
- key_entry->description,
- KEYENTRY_COLUMN, key_entry,
- -1);
- else
- gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
- DESCRIPTION_COLUMN, _("<Unknown Action>"),
- KEYENTRY_COLUMN, key_entry,
- -1);
+ /* we use the DESCRIPTION_COLUMN only for the section headers */
+ gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
+ KEYENTRY_COLUMN, key_entry,
+ -1);
gtk_tree_view_expand_all (GTK_TREE_VIEW (WID ("shortcut_treeview")));
- gconf_entry_free (entry);
- gconf_schema_free (schema);
}
g_object_unref (client);
@@ -613,6 +669,7 @@
return;
key.name = g_strdup (name);
+ key.description_name = NULL;
key.value = value;
if (gconf_key)
key.key = g_strdup (gconf_key);
@@ -679,6 +736,7 @@
/* Empty KeyListEntry to end the array */
key.name = NULL;
+ key.description_name = NULL;
key.key = NULL;
key.value = 0;
key.comparison = COMPARISON_NONE;
@@ -703,6 +761,58 @@
}
static void
+append_keys_to_tree_from_gconf (GladeXML *dialog, const gchar *gconf_path)
+{
+ GConfClient *client;
+ GSList *custom_list, *l;
+ GArray *entries;
+ KeyListEntry key;
+
+ /* load custom shortcuts from GConf */
+ entries = g_array_new (FALSE, TRUE, sizeof (KeyListEntry));
+
+ key.key = NULL;
+ key.value = 0;
+ key.comparison = COMPARISON_NONE;
+
+ client = gconf_client_get_default ();
+ custom_list = gconf_client_all_dirs (client, gconf_path, NULL);
+
+ for (l = custom_list; l != NULL; l = l->next)
+ {
+ key.name = g_strconcat (l->data, "/binding", NULL);
+ key.description_name = g_strconcat (l->data, "/action", NULL);
+ g_array_append_val (entries, key);
+
+ g_free (l->data);
+ }
+
+ g_slist_free (custom_list);
+ g_object_unref (client);
+
+ if (entries->len > 0)
+ {
+ KeyListEntry *keys;
+ int i;
+
+ /* Empty KeyListEntry to end the array */
+ key.name = NULL;
+ key.description_name = NULL;
+ g_array_append_val (entries, key);
+
+ keys = (KeyListEntry *) entries->data;
+ append_keys_to_tree (dialog, _("Custom Shortcuts"), keys);
+ for (i = 0; i < entries->len; ++i)
+ {
+ g_free (keys[i].name);
+ g_free (keys[i].description_name);
+ }
+ }
+
+ g_array_free (entries, TRUE);
+}
+
+static void
reload_key_entries (gpointer wm_name, GladeXML *dialog)
{
GDir *dir;
@@ -736,6 +846,8 @@
g_free (path);
}
g_list_free (list);
+
+ append_keys_to_tree_from_gconf (dialog, GCONF_BINDING_DIR);
}
static void
@@ -775,6 +887,8 @@
new_key->editable = FALSE;
new_key->gconf_key = element->gconf_key;
new_key->description = element->description;
+ new_key->desc_gconf_key = element->desc_gconf_key;
+ new_key->desc_editable = element->desc_editable;
return TRUE;
}
@@ -883,7 +997,7 @@
GTK_MESSAGE_WARNING,
GTK_BUTTONS_CANCEL,
_("The shortcut \"%s\" cannot be used because it will become impossible to type using this key.\n"
- "Please try with a key such as Control, Alt or Shift at the same time.\n"),
+ "Please try with a key such as Control, Alt or Shift at the same time."),
name);
g_free (name);
@@ -911,7 +1025,7 @@
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_CANCEL,
- _("The shortcut \"%s\" is already used for:\n \"%s\"\n"),
+ _("The shortcut \"%s\" is already used for:\n \"%s\""),
name,
tmp_key.description ?
tmp_key.description : tmp_key.gconf_key);
@@ -927,13 +1041,13 @@
str = binding_name (keyval, keycode, mask, FALSE);
- client = gconf_client_get_default();
+ client = gconf_client_get_default ();
gconf_client_set_string (client,
key_entry->gconf_key,
str,
&err);
g_free (str);
- g_object_unref (G_OBJECT (client));
+ g_object_unref (client);
if (err != NULL)
{
@@ -943,7 +1057,7 @@
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK,
- _("Error setting new accelerator in configuration database: %s\n"),
+ _("Error setting new accelerator in configuration database: %s"),
err->message);
gtk_dialog_run (GTK_DIALOG (dialog));
@@ -985,7 +1099,7 @@
key_entry->gconf_key,
"disabled",
&err);
- g_object_unref (G_OBJECT (client));
+ g_object_unref (client);
if (err != NULL)
{
@@ -995,7 +1109,7 @@
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK,
- _("Error unsetting accelerator in configuration database: %s\n"),
+ _("Error unsetting accelerator in configuration database: %s"),
err->message);
gtk_dialog_run (GTK_DIALOG (dialog));
@@ -1005,11 +1119,44 @@
}
}
+static void
+description_edited_callback (GtkCellRendererText *renderer,
+ gchar *path_string,
+ gchar *new_text,
+ gpointer user_data)
+{
+ GConfClient *client;
+ GtkTreeView *view = GTK_TREE_VIEW (user_data);
+ GtkTreeModel *model;
+ GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
+ GtkTreeIter iter;
+ KeyEntry *key_entry;
+
+ model = gtk_tree_view_get_model (view);
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_path_free (path);
+
+ gtk_tree_model_get (model, &iter,
+ KEYENTRY_COLUMN, &key_entry,
+ -1);
+
+ /* sanity check */
+ if (key_entry == NULL || key_entry->desc_gconf_key == NULL)
+ return;
+
+ client = gconf_client_get_default ();
+ if (!gconf_client_set_string (client, key_entry->desc_gconf_key, new_text, NULL))
+ key_entry->desc_editable = FALSE;
+
+ g_object_unref (client);
+}
+
typedef struct
{
GtkTreeView *tree_view;
GtkTreePath *path;
+ GtkTreeViewColumn *column;
} IdleData;
static gboolean
@@ -1018,9 +1165,8 @@
gtk_widget_grab_focus (GTK_WIDGET (idle_data->tree_view));
gtk_tree_view_set_cursor (idle_data->tree_view,
idle_data->path,
- gtk_tree_view_get_column (idle_data->tree_view, 1),
+ idle_data->column,
TRUE);
-
gtk_tree_path_free (idle_data->path);
g_free (idle_data);
return FALSE;
@@ -1047,6 +1193,7 @@
gpointer user_data)
{
GtkTreePath *path;
+ GtkTreeViewColumn *column;
if (event->window != gtk_tree_view_get_bin_window (tree_view))
return FALSE;
@@ -1054,10 +1201,13 @@
if (gtk_tree_view_get_path_at_pos (tree_view,
(gint) event->x,
(gint) event->y,
- &path, NULL,
+ &path, &column,
NULL, NULL))
{
IdleData *idle_data;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ KeyEntry *key;
if (gtk_tree_path_get_depth (path) == 1)
{
@@ -1065,10 +1215,20 @@
return FALSE;
}
+ model = gtk_tree_view_get_model (tree_view);
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter,
+ KEYENTRY_COLUMN, &key,
+ -1);
+
idle_data = g_new (IdleData, 1);
idle_data->tree_view = tree_view;
idle_data->path = path;
- g_signal_stop_emission_by_name (G_OBJECT (tree_view), "button_press_event");
+ /* if only the accel can be edited on the selected row
+ * always select the accel column */
+ idle_data->column = key->desc_editable ? column :
+ gtk_tree_view_get_column (tree_view, 1);
+ g_signal_stop_emission_by_name (tree_view, "button_press_event");
g_idle_add ((GSourceFunc) real_start_editing_cb, idle_data);
block_accels = TRUE;
}
@@ -1115,49 +1275,52 @@
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkWidget *widget;
+ GtkTreeView *treeview = GTK_TREE_VIEW (WID ("shortcut_treeview"));
gchar *wm_name;
client = gconf_client_get_default ();
- g_signal_connect (GTK_TREE_VIEW (WID ("shortcut_treeview")),
- "button_press_event",
+ g_signal_connect (treeview, "button_press_event",
G_CALLBACK (start_editing_cb), NULL);
- g_signal_connect (GTK_TREE_VIEW (WID ("shortcut_treeview")),
- "row-activated",
+ g_signal_connect (treeview, "row-activated",
G_CALLBACK (start_editing_kb_cb), NULL);
+ renderer = gtk_cell_renderer_text_new ();
+
+ g_signal_connect (renderer, "edited",
+ G_CALLBACK (description_edited_callback),
+ treeview);
+
column = gtk_tree_view_column_new_with_attributes (_("Action"),
- gtk_cell_renderer_text_new (),
+ renderer,
"text", DESCRIPTION_COLUMN,
NULL);
+ gtk_tree_view_column_set_cell_data_func (column, renderer, description_set_func, NULL, NULL);
gtk_tree_view_column_set_resizable (column, FALSE);
- gtk_tree_view_append_column (GTK_TREE_VIEW (WID ("shortcut_treeview")), column);
+ gtk_tree_view_append_column (treeview, column);
gtk_tree_view_column_set_sort_column_id (column, DESCRIPTION_COLUMN);
renderer = (GtkCellRenderer *) g_object_new (EGG_TYPE_CELL_RENDERER_KEYS,
- "editable", TRUE,
"accel_mode", EGG_CELL_RENDERER_KEYS_MODE_X,
NULL);
- g_signal_connect (G_OBJECT (renderer),
- "accel_edited",
+ g_signal_connect (renderer, "accel_edited",
G_CALLBACK (accel_edited_callback),
- WID ("shortcut_treeview"));
+ treeview);
- g_signal_connect (G_OBJECT (renderer),
- "accel_cleared",
+ g_signal_connect (renderer, "accel_cleared",
G_CALLBACK (accel_cleared_callback),
- WID ("shortcut_treeview"));
+ treeview);
column = gtk_tree_view_column_new_with_attributes (_("Shortcut"), renderer, NULL);
gtk_tree_view_column_set_cell_data_func (column, renderer, accel_set_func, NULL, NULL);
gtk_tree_view_column_set_resizable (column, FALSE);
- gtk_tree_view_append_column (GTK_TREE_VIEW (WID ("shortcut_treeview")), column);
+ gtk_tree_view_append_column (treeview, column);
gtk_tree_view_column_set_sort_column_id (column, KEYENTRY_COLUMN);
- gconf_client_add_dir (client, "/apps/gnome_keybinding_properties", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+ gconf_client_add_dir (client, GCONF_BINDING_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
gconf_client_add_dir (client, "/apps/metacity/general", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
gconf_client_notify_add (client,
"/apps/metacity/general/num_workspaces",
@@ -1174,8 +1337,8 @@
capplet_set_icon (widget, "gnome-settings-keybindings");
gtk_widget_show (widget);
- g_signal_connect (G_OBJECT (widget), "key_press_event", G_CALLBACK (maybe_block_accels), NULL);
- g_signal_connect (G_OBJECT (widget), "response", G_CALLBACK (cb_dialog_response), dialog);
+ g_signal_connect (widget, "key_press_event", G_CALLBACK (maybe_block_accels), NULL);
+ g_signal_connect (widget, "response", G_CALLBACK (cb_dialog_response), dialog);
}
int
Modified: branches/randr-12/capplets/network/gnome-network-preferences.c
==============================================================================
--- branches/randr-12/capplets/network/gnome-network-preferences.c (original)
+++ branches/randr-12/capplets/network/gnome-network-preferences.c Tue Jun 17 23:18:22 2008
@@ -24,10 +24,10 @@
# include <config.h>
#endif
+#include <string.h>
#include <libgnome/libgnome.h>
#include <gconf/gconf-client.h>
#include <glade/glade.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
#include "capplet-util.h"
#include "gconf-property-editor.h"
@@ -336,27 +336,58 @@
g_object_unref (client);
}
+static gchar *
+get_hostname_from_uri (const gchar *uri)
+{
+ const gchar *start, *end;
+ gchar *host;
+
+ if (uri == NULL)
+ return NULL;
+
+ /* skip the scheme part */
+ start = strchr (uri, ':');
+ if (start == NULL)
+ return NULL;
+
+ /* forward until after the last '/' */
+ do {
+ ++start;
+ } while (*start == '/');
+
+ if (*start == '\0')
+ return NULL;
+
+ /* maybe we have a port? */
+ end = strchr (start, ':');
+ if (end == NULL)
+ end = strchr (start, '/');
+
+ if (end != NULL)
+ host = g_strndup (start, end - start);
+ else
+ host = g_strdup (start);
+
+ return host;
+}
+
static GConfValue *
extract_proxy_host (GConfPropertyEditor *peditor, const GConfValue *orig)
{
- char const *entered_text = gconf_value_get_string (orig);
- GConfValue *res = NULL;
+ char const *entered_text = gconf_value_get_string (orig);
+ GConfValue *res = NULL;
if (entered_text != NULL) {
- GnomeVFSURI *uri = gnome_vfs_uri_new (entered_text);
- if (uri != NULL) {
- char const *host = gnome_vfs_uri_get_host_name (uri);
- if (host != NULL) {
- res = gconf_value_new (GCONF_VALUE_STRING);
- gconf_value_set_string (res, host);
- }
- gnome_vfs_uri_unref (uri);
+ gchar *host = get_hostname_from_uri (entered_text);
+
+ if (host != NULL) {
+ res = gconf_value_new (GCONF_VALUE_STRING);
+ gconf_value_set_string (res, host);
+ g_free (host);
}
}
- if (res != NULL)
- return res;
- return gconf_value_copy (orig);
+ return (res != NULL) ? res : gconf_value_copy (orig);
}
static void
@@ -538,8 +569,6 @@
argc, argv, GNOME_PARAM_NONE);
client = gconf_client_get_default ();
- gconf_client_add_dir (client, "/system/gnome-vfs",
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
gconf_client_add_dir (client, "/system/http_proxy",
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
gconf_client_add_dir (client, "/system/proxy",
Modified: branches/randr-12/configure.in
==============================================================================
--- branches/randr-12/configure.in (original)
+++ branches/randr-12/configure.in Tue Jun 17 23:18:22 2008
@@ -1,4 +1,4 @@
-AC_INIT([gnome-control-center], [2.23.1],
+AC_INIT([gnome-control-center], [2.23.4],
[http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-control-center])
AC_CONFIG_MACRO_DIR([m4])
@@ -94,9 +94,7 @@
gconf-2.0 dnl
libgnomeui-2.0 >= 2.2.0 dnl
libglade-2.0 >= 2.0.0 dnl
- libbonobo-2.0 dnl
- libbonoboui-2.0 dnl
- gnome-desktop-2.0 >= 2.21.4"
+ gnome-desktop-2.0 >= 2.23.4"
PKG_CHECK_MODULES(LIBSLAB, $COMMON_MODULES gnome-desktop-2.0 librsvg-2.0 libgnome-menu pango eel-2.0)
PKG_CHECK_MODULES(CAPPLET, $COMMON_MODULES)
PKG_CHECK_MODULES(GNOMECC, $COMMON_MODULES libgnome-menu >= 2.10.1 libpanelapplet-2.0)
@@ -107,7 +105,6 @@
PKG_CHECK_MODULES(DEFAULT_APPLICATIONS_CAPPLET, libxml-2.0)
PKG_CHECK_MODULES(METACITY, libmetacity-private >= 2.23.1)
PKG_CHECK_MODULES(TYPING, glib-2.0 > 2.11 gconf-2.0 gtk+-2.0)
-PKG_CHECK_MODULES(LIBBACKGROUND, glib-2.0 gobject-2.0 gdk-2.0 gconf-2.0)
PKG_CHECK_MODULES(LIBSOUNDS, gio-2.0 libgnome-2.0 libgnomeui-2.0)
PKG_CHECK_MODULES(GSD_DBUS, gnome-settings-daemon)
@@ -191,7 +188,7 @@
AC_SUBST(LIBGNOMEKBDUI_LIBS)
dnl ==============================================
-dnl themus and fontilus dependencies
+dnl fontilus dependencies
dnl ==============================================
AC_ARG_ENABLE(vfs-methods,
@@ -201,23 +198,6 @@
if test x$enable_vfs_methods = xyes; then
- PKG_CHECK_MODULES(THEME_METHOD,
- [gnome-vfs-module-2.0 >= 2.2.0 dnl
- gnome-vfs-2.0 >= 2.2.0])
- PKG_CHECK_MODULES(THEMUS_THUMBNAILER,
- [gdk-2.0 >= 2.2.0 dnl
- libgnomeui-2.0 >= 2.2.0 dnl
- libmetacity-private dnl
- gnome-vfs-2.0 >= 2.2.0])
- PKG_CHECK_MODULES(THEMUS_COMPONENT,
- [glib-2.0 >= 2.8.0 dnl
- gtk+-2.0 >= 2.4.0 dnl
- libnautilus-extension >= nautilus_minver])
- PKG_CHECK_MODULES(THEMUS_APPLIER,
- [gtk+-2.0 >= 2.4.0 dnl
- libglade-2.0 >= 2.0 dnl
- gnome-vfs-2.0 >= 2.2.0 dnl
- libgnome-2.0 >= 2.2.0])
PKG_CHECK_MODULES(FONT_METHOD,
[gnome-vfs-module-2.0 >= gnomevfs_minver dnl
fontconfig >= fontconfig_minver])
@@ -242,9 +222,7 @@
FONT_THUMBNAILER_CFLAGS="$FONT_THUMBNAILER_CFLAGS `$FREETYPE_CONFIG --cflags`"
FONT_THUMBNAILER_LIBS="$FONT_THUMBNAILER_LIBS `$FREETYPE_CONFIG --libs`"
- THEMUS=themus
FONTILUS=fontilus
- AC_SUBST(THEMUS)
AC_SUBST(FONTILUS)
# Determine the install dir for the nautilus extensions.
@@ -254,8 +232,6 @@
# update LIBS for $export_dynamic
export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
if test -n "$export_dynamic"; then
- THEME_METHOD_LIBS=`echo $THEME_METHOD_LIBS | sed -e "s/$export_dynamic//"`
- THEMUS_COMPONENT_LIBS=`echo $THEMUS_COMPONENT_LIBS | sed -e "s/$export_dynamic//"`
FONT_VIEW_LIBS=`echo $FONT_VIEW_LIBS | sed -e "s/$export_dynamic//"`
FONT_CONTEXT_MENU_LIBS=`echo $FONT_CONTEXT_MENU_LIBS | sed -e "s/$export_dynamic//"`
FONT_THUMBNAILER_LIBS=`echo $FONT_THUMBNAILER_LIBS | sed -e "s/$export_dynamic//"`
@@ -450,7 +426,6 @@
capplets/windows/Makefile
capplets/windows/window-properties.desktop.in
help/Makefile
-libbackground/Makefile
libslab/Makefile
libslab/libslab.pc
libsounds/Makefile
@@ -463,8 +438,6 @@
vfs-methods/Makefile
vfs-methods/fontilus/Makefile
vfs-methods/fontilus/gnome-font-viewer.desktop.in
-vfs-methods/themus/Makefile
-vfs-methods/themus/themus-theme-applier.desktop.in
])
dnl due to a bug in intltool we need to expand something from the root last control-center.spec
Modified: branches/randr-12/po/POTFILES.in
==============================================================================
--- branches/randr-12/po/POTFILES.in (original)
+++ branches/randr-12/po/POTFILES.in Tue Jun 17 23:18:22 2008
@@ -67,7 +67,6 @@
capplets/windows/gnome-window-properties.c
capplets/windows/gnome-window-properties.glade
capplets/windows/window-properties.desktop.in.in
-libbackground/preferences.c
libslab/application-tile.c
libslab/app-shell.c
libslab/bookmark-agent.c
@@ -91,11 +90,3 @@
vfs-methods/fontilus/font-view.c
vfs-methods/fontilus/gnome-font-viewer.desktop.in.in
vfs-methods/fontilus/thumbnailer.c
-vfs-methods/themus/apply-font.glade
-vfs-methods/themus/theme-method.c
-vfs-methods/themus/theme-method.directory.in
-vfs-methods/themus/themus-properties-main.c
-vfs-methods/themus/themus-properties-view.c
-vfs-methods/themus/themus.schemas.in
-vfs-methods/themus/themus-theme-applier.c
-vfs-methods/themus/themus-theme-applier.desktop.in.in
Modified: branches/randr-12/po/POTFILES.skip
==============================================================================
--- branches/randr-12/po/POTFILES.skip (original)
+++ branches/randr-12/po/POTFILES.skip Tue Jun 17 23:18:22 2008
@@ -23,3 +23,11 @@
schemas/apps_gnome_settings_daemon_default_editor.schemas.in
schemas/apps_gnome_settings_daemon_keybindings.schemas.in
schemas/apps_gnome_settings_daemon_screensaver.schemas.in
+vfs-methods/themus/apply-font.glade
+vfs-methods/themus/theme-method.c
+vfs-methods/themus/theme-method.directory.in
+vfs-methods/themus/themus-properties-main.c
+vfs-methods/themus/themus-properties-view.c
+vfs-methods/themus/themus.schemas.in
+vfs-methods/themus/themus-theme-applier.c
+vfs-methods/themus/themus-theme-applier.desktop.in.in
Modified: branches/randr-12/typing-break/drwright.c
==============================================================================
--- branches/randr-12/typing-break/drwright.c (original)
+++ branches/randr-12/typing-break/drwright.c Tue Jun 17 23:18:22 2008
@@ -69,6 +69,7 @@
GTimer *idle_timer;
gint last_elapsed_time;
+ gint save_last_time;
gboolean is_active;
@@ -177,14 +178,9 @@
r = 0;
break;
- case STATE_WARN_IDLE:
- case STATE_WARN_TYPE:
- r = ((float)(dr->type_time - dr->warn_time) / dr->type_time) +
- (float) g_timer_elapsed (dr->timer, NULL) / (float) dr->warn_time;
- break;
-
default:
- r = (float) g_timer_elapsed (dr->timer, NULL) / (float) dr->type_time;
+ r = (float) (g_timer_elapsed (dr->timer, NULL) + dr->save_last_time) /
+ (float) dr->type_time;
break;
}
@@ -237,7 +233,7 @@
gfloat r;
gint timeout;
- r = (dr->warn_time - g_timer_elapsed (dr->timer, NULL)) / dr->warn_time;
+ r = (dr->type_time - g_timer_elapsed (dr->timer, NULL) - dr->save_last_time) / dr->warn_time;
timeout = BLINK_TIMEOUT + BLINK_TIMEOUT_FACTOR * r;
if (timeout < BLINK_TIMEOUT_MIN) {
@@ -321,7 +317,7 @@
g_timer_reset (dr->idle_timer);
}
- elapsed_time = g_timer_elapsed (dr->timer, NULL);
+ elapsed_time = g_timer_elapsed (dr->timer, NULL) + dr->save_last_time;
elapsed_idle_time = g_timer_elapsed (dr->idle_timer, NULL);
if (elapsed_time > dr->last_elapsed_time + dr->warn_time) {
@@ -342,6 +338,8 @@
gtk_status_icon_set_from_pixbuf (dr->icon,
dr->neutral_bar);
+ dr->save_last_time = 0;
+
g_timer_start (dr->timer);
g_timer_start (dr->idle_timer);
@@ -355,8 +353,7 @@
case STATE_IDLE:
if (elapsed_idle_time >= dr->break_time) {
- g_timer_start (dr->timer);
- g_timer_start (dr->idle_timer);
+ dr->state = STATE_BREAK_DONE_SETUP;
} else if (dr->is_active) {
dr->state = STATE_TYPE;
}
@@ -365,7 +362,6 @@
case STATE_TYPE:
if (elapsed_time >= dr->type_time - dr->warn_time) {
dr->state = STATE_WARN_TYPE;
- g_timer_start (dr->timer);
start_blinking (dr);
} else if (elapsed_time >= dr->type_time) {
@@ -378,7 +374,7 @@
break;
case STATE_WARN_TYPE:
- if (elapsed_time >= dr->warn_time) {
+ if (elapsed_time >= dr->type_time) {
dr->state = STATE_BREAK_SETUP;
}
else if (!dr->is_active) {
@@ -436,11 +432,12 @@
gtk_widget_show (dr->break_window);
+ dr->save_last_time = elapsed_time;
dr->state = STATE_BREAK;
break;
case STATE_BREAK:
- if (elapsed_time >= dr->break_time) {
+ if (elapsed_time - dr->save_last_time >= dr->break_time) {
dr->state = STATE_BREAK_DONE_SETUP;
}
break;
@@ -486,16 +483,7 @@
elapsed_time = g_timer_elapsed (dr->timer, NULL);
- switch (dr->state) {
- case STATE_WARN_TYPE:
- case STATE_WARN_IDLE:
- min = floor (0.5 + (dr->warn_time - elapsed_time) / 60.0);
- break;
-
- default:
- min = floor (0.5 + (dr->type_time - elapsed_time) / 60.0);
- break;
- }
+ min = floor (0.5 + (dr->type_time - elapsed_time - dr->save_last_time) / 60.0);
if (min >= 1) {
str = g_strdup_printf (ngettext("%d minute until the next break",
@@ -661,13 +649,22 @@
break_window_postpone_cb (GtkWidget *window,
DrWright *dr)
{
+ gint elapsed_time;
+
gtk_widget_destroy (dr->break_window);
- dr->state = STATE_WARN_TYPE;
+ dr->state = STATE_TYPE;
dr->break_window = NULL;
+ elapsed_time = g_timer_elapsed (dr->timer, NULL) + dr->save_last_time;
+
+ if (elapsed_time >= dr->type_time) {
+ /* time is expired, but break was postponed */
+ dr->save_last_time = dr->type_time - dr->warn_time;
+ }
+
g_timer_start (dr->timer);
- start_blinking (dr);
+ maybe_change_state (dr);
update_icon (dr);
update_tooltip (dr);
}
Modified: branches/randr-12/vfs-methods/Makefile.am
==============================================================================
--- branches/randr-12/vfs-methods/Makefile.am (original)
+++ branches/randr-12/vfs-methods/Makefile.am Tue Jun 17 23:18:22 2008
@@ -1 +1 @@
-SUBDIRS = $(THEMUS) $(FONTILUS)
+SUBDIRS = $(FONTILUS)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]