Compare commits
17 Commits
release46r
...
wip/univer
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8aae16457e | ||
|
|
b85c775993 | ||
|
|
75ffcb57f4 | ||
|
|
afe05a44fc | ||
|
|
6da7b3b227 | ||
|
|
b8a872b7fd | ||
|
|
73bcc33f34 | ||
|
|
e7641836c2 | ||
|
|
d7163928c9 | ||
|
|
f47f88e92b | ||
|
|
32b45ed09b | ||
|
|
65c8dafa82 | ||
|
|
77b36b1db7 | ||
|
|
fe0d9152b0 | ||
|
|
43fd5b0122 | ||
|
|
081b8a2c6b | ||
|
|
33bcfa79db |
@@ -390,6 +390,8 @@ capplets/display/display-properties.desktop.in
|
||||
panels/keybindings/Makefile
|
||||
panels/keybindings/gnome-keybindings.pc
|
||||
panels/keybindings/gnome-keybindings-panel.desktop.in
|
||||
panels/universal-access/Makefile
|
||||
panels/universal-access/gnome-universal-access.desktop.in
|
||||
docs/Makefile
|
||||
docs/reference/Makefile
|
||||
docs/reference/libgnome-control-center/Makefile
|
||||
|
||||
@@ -1 +1 @@
|
||||
SUBDIRS=mouse keyboard network default-applications keybindings
|
||||
SUBDIRS=mouse keyboard network default-applications keybindings universal-access
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="xscale">0</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox2">
|
||||
|
||||
31
panels/universal-access/Makefile.am
Normal file
31
panels/universal-access/Makefile.am
Normal file
@@ -0,0 +1,31 @@
|
||||
INCLUDES = \
|
||||
$(PANEL_CFLAGS) \
|
||||
$(GNOMECC_CAPPLETS_CFLAGS) \
|
||||
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
|
||||
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
|
||||
$(NULL)
|
||||
|
||||
ccpanelsdir = $(PANELS_DIR)
|
||||
ccpanels_LTLIBRARIES = libuniversal-access.la
|
||||
|
||||
libuniversal_access_la_SOURCES = \
|
||||
universal-access-module.c \
|
||||
cc-ua-panel.c \
|
||||
cc-ua-panel.h
|
||||
|
||||
libuniversal_access_la_LIBADD = $(PANEL_LIBS)
|
||||
libuniversal_access_la_LDFLAGS = $(PANEL_LDFLAGS)
|
||||
|
||||
uidir = $(pkgdatadir)/ui
|
||||
ui_DATA = uap.ui
|
||||
|
||||
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
||||
desktopdir = $(datadir)/applications
|
||||
desktop_in_files = gnome-universal-access.desktop.in
|
||||
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
|
||||
|
||||
CLEANFILES = $(desktop_in_files) $(desktop_DATA)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
781
panels/universal-access/cc-ua-panel.c
Normal file
781
panels/universal-access/cc-ua-panel.c
Normal file
@@ -0,0 +1,781 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
||||
*
|
||||
* Copyright (C) 2010 Intel, Inc
|
||||
* Copyright (C) 2008 William Jon McCann <jmccann@redhat.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Author: Thomas Wood <thomas.wood@intel.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "cc-ua-panel.h"
|
||||
|
||||
#include <gconf/gconf-client.h>
|
||||
|
||||
#include "gconf-property-editor.h"
|
||||
|
||||
|
||||
#define CONFIG_ROOT "/desktop/gnome/accessibility"
|
||||
|
||||
#define KEY_CONFIG_ROOT CONFIG_ROOT "/keyboard"
|
||||
#define MOUSE_CONFIG_ROOT CONFIG_ROOT "/mouse"
|
||||
|
||||
#define WID(b, w) (GtkWidget *) gtk_builder_get_object (b, w)
|
||||
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (CcUaPanel, cc_ua_panel, CC_TYPE_PANEL)
|
||||
|
||||
#define UA_PANEL_PRIVATE(o) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_UA_PANEL, CcUaPanelPrivate))
|
||||
|
||||
struct _CcUaPanelPrivate
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GConfClient *client;
|
||||
|
||||
GSList *notify_list;
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
cc_ua_panel_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (property_id)
|
||||
{
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cc_ua_panel_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (property_id)
|
||||
{
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cc_ua_panel_dispose (GObject *object)
|
||||
{
|
||||
CcUaPanelPrivate *priv = CC_UA_PANEL (object)->priv;
|
||||
GSList *l;
|
||||
|
||||
/* remove the notify callbacks, since they rely on builder/client being
|
||||
* available */
|
||||
if (priv->notify_list)
|
||||
{
|
||||
for (l = priv->notify_list; l; l = g_slist_next (l))
|
||||
{
|
||||
gconf_client_notify_remove (priv->client,
|
||||
GPOINTER_TO_INT (l->data));
|
||||
}
|
||||
g_slist_free (priv->notify_list);
|
||||
priv->notify_list = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (priv->builder)
|
||||
{
|
||||
g_object_unref (priv->builder);
|
||||
priv->builder = NULL;
|
||||
}
|
||||
|
||||
if (priv->client)
|
||||
{
|
||||
g_object_unref (priv->client);
|
||||
priv->client = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (cc_ua_panel_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_ua_panel_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (cc_ua_panel_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_ua_panel_class_init (CcUaPanelClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (CcUaPanelPrivate));
|
||||
|
||||
object_class->get_property = cc_ua_panel_get_property;
|
||||
object_class->set_property = cc_ua_panel_set_property;
|
||||
object_class->dispose = cc_ua_panel_dispose;
|
||||
object_class->finalize = cc_ua_panel_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
cc_ua_panel_class_finalize (CcUaPanelClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
static gchar *sticky_keys_section[] = {
|
||||
"typing_sticky_keys_disable_two_keys_checkbutton",
|
||||
"typing_sticky_keys_beep_modifier_checkbutton",
|
||||
NULL
|
||||
};
|
||||
|
||||
static gchar *slow_keys_section[]= {
|
||||
"typing_slowkeys_delay_box",
|
||||
"typing_slow_keys_beeb_box",
|
||||
NULL
|
||||
};
|
||||
|
||||
static gchar *bounce_keys_section[] = {
|
||||
"typing_bouncekeys_delay_box",
|
||||
"typing_bounce_keys_beep_rejected_checkbutton",
|
||||
NULL
|
||||
};
|
||||
|
||||
static gchar *secondary_click_section[] = {
|
||||
"pointing_secondary_click_scale_box",
|
||||
NULL
|
||||
};
|
||||
|
||||
static gchar *dwell_click_section[] = {
|
||||
"pointing_hover_click_delay_scale_box",
|
||||
"pointing_hover_click_threshold_scale_box",
|
||||
NULL
|
||||
};
|
||||
|
||||
static gchar *visual_alerts_section[] = {
|
||||
"hearing_test_flash_button",
|
||||
"hearing_flash_window_title_button",
|
||||
"hearing_flash_screen_button",
|
||||
NULL
|
||||
};
|
||||
|
||||
static void
|
||||
cc_ua_panel_section_toggled (GtkToggleButton *button,
|
||||
GtkBuilder *builder)
|
||||
{
|
||||
GtkWidget *w;
|
||||
gboolean enabled;
|
||||
gchar **widgets, **s;
|
||||
|
||||
widgets = g_object_get_data (G_OBJECT (button), "section-widgets");
|
||||
|
||||
enabled = gtk_toggle_button_get_active (button);
|
||||
|
||||
for (s = widgets; *s; s++)
|
||||
{
|
||||
w = WID (builder, *s);
|
||||
gtk_widget_set_sensitive (w, enabled);
|
||||
}
|
||||
}
|
||||
|
||||
static GConfValue*
|
||||
cc_ua_panel_toggle_radios (GConfPropertyEditor *peditor,
|
||||
const GConfValue *value)
|
||||
{
|
||||
GtkWidget *radio;
|
||||
gboolean enabled;
|
||||
|
||||
enabled = gconf_value_get_bool (value);
|
||||
radio = (GtkWidget*) gconf_property_editor_get_ui_control (peditor);
|
||||
|
||||
|
||||
if (!enabled)
|
||||
{
|
||||
GSList *list, *l;
|
||||
|
||||
list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
|
||||
|
||||
if (list)
|
||||
{
|
||||
/* activate the "off" button */
|
||||
for (l = list; l; l = l->next)
|
||||
{
|
||||
if (l->data == radio)
|
||||
continue;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (l->data),
|
||||
TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return gconf_value_copy (value);
|
||||
}
|
||||
|
||||
static void
|
||||
gconf_on_off_peditor_new (CcUaPanelPrivate *priv,
|
||||
const gchar *key,
|
||||
GtkWidget *widget,
|
||||
gchar **section)
|
||||
{
|
||||
GObject *peditor;
|
||||
|
||||
/* set data to enable/disable the section this on/off switch controls */
|
||||
if (section)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (widget), "section-widgets", section);
|
||||
g_signal_connect (widget, "toggled",
|
||||
G_CALLBACK (cc_ua_panel_section_toggled),
|
||||
priv->builder);
|
||||
}
|
||||
|
||||
/* set up the boolean editor */
|
||||
peditor = gconf_peditor_new_boolean (NULL, key, widget, NULL);
|
||||
g_object_set (peditor, "conv-to-widget-cb", cc_ua_panel_toggle_radios, NULL);
|
||||
|
||||
/* emit the notify on the key, so that the conv-to-widget-cb callback is run
|
||||
*/
|
||||
gconf_client_notify (priv->client, key);
|
||||
}
|
||||
|
||||
/* seeing section */
|
||||
#define GTK_THEME_KEY "/desktop/gnome/interface/gtk_theme"
|
||||
#define ICON_THEME_KEY "/desktop/gnome/interface/icon_theme"
|
||||
#define CONTRAST_MODEL_THEME_COLUMN 3
|
||||
#define DPI_MODEL_FACTOR_COLUMN 2
|
||||
|
||||
#define DPI_KEY "/desktop/gnome/font_rendering/dpi"
|
||||
|
||||
/* The following two functions taken from gsd-a11y-preferences-dialog.c
|
||||
*
|
||||
* Copyright (C) 2008 William Jon McCann <jmccann@redhat.com>
|
||||
*
|
||||
* Licensed under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
/* X servers sometimes lie about the screen's physical dimensions, so we cannot
|
||||
* compute an accurate DPI value. When this happens, the user gets fonts that
|
||||
* are too huge or too tiny. So, we see what the server returns: if it reports
|
||||
* something outside of the range [DPI_LOW_REASONABLE_VALUE,
|
||||
* DPI_HIGH_REASONABLE_VALUE], then we assume that it is lying and we use
|
||||
* DPI_FALLBACK instead.
|
||||
*
|
||||
* See get_dpi_from_gconf_or_server() below, and also
|
||||
* https://bugzilla.novell.com/show_bug.cgi?id=217790
|
||||
*/
|
||||
#define DPI_LOW_REASONABLE_VALUE 50
|
||||
#define DPI_HIGH_REASONABLE_VALUE 500
|
||||
#define DPI_DEFAULT 96
|
||||
|
||||
static gdouble
|
||||
dpi_from_pixels_and_mm (gint pixels,
|
||||
gint mm)
|
||||
{
|
||||
gdouble dpi;
|
||||
|
||||
if (mm >= 1)
|
||||
return pixels / (mm / 25.4);
|
||||
else
|
||||
return dpi = 0;
|
||||
}
|
||||
|
||||
static gdouble
|
||||
get_dpi_from_x_server ()
|
||||
{
|
||||
GdkScreen *screen;
|
||||
gdouble dpi;
|
||||
|
||||
screen = gdk_screen_get_default ();
|
||||
|
||||
if (screen)
|
||||
{
|
||||
gdouble width_dpi, height_dpi;
|
||||
|
||||
width_dpi = dpi_from_pixels_and_mm (gdk_screen_get_width (screen),
|
||||
gdk_screen_get_width_mm (screen));
|
||||
height_dpi = dpi_from_pixels_and_mm (gdk_screen_get_height (screen),
|
||||
gdk_screen_get_height_mm (screen));
|
||||
|
||||
if (width_dpi < DPI_LOW_REASONABLE_VALUE
|
||||
|| width_dpi > DPI_HIGH_REASONABLE_VALUE
|
||||
|| height_dpi < DPI_LOW_REASONABLE_VALUE
|
||||
|| height_dpi > DPI_HIGH_REASONABLE_VALUE)
|
||||
{
|
||||
dpi = DPI_DEFAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
dpi = (width_dpi + height_dpi) / 2.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
dpi = DPI_DEFAULT;
|
||||
|
||||
return dpi;
|
||||
}
|
||||
|
||||
static void
|
||||
dpi_notify_cb (GConfClient *client,
|
||||
guint cnxn_id,
|
||||
GConfEntry *entry,
|
||||
CcUaPanel *panel)
|
||||
{
|
||||
CcUaPanelPrivate *priv = panel->priv;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
GtkWidget *combo;
|
||||
gboolean valid;
|
||||
gdouble gconf_value;
|
||||
gdouble x_dpi;
|
||||
|
||||
if (!entry->value)
|
||||
return;
|
||||
|
||||
gconf_value = gconf_value_get_float (entry->value);
|
||||
|
||||
combo = WID (priv->builder, "seeing_text_size_combobox");
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
|
||||
|
||||
/* get current value from screen */
|
||||
x_dpi = get_dpi_from_x_server ();
|
||||
|
||||
/* see if the calculated value matches in the combobox model */
|
||||
valid = gtk_tree_model_get_iter_first (model, &iter);
|
||||
while (valid)
|
||||
{
|
||||
gfloat factor;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
DPI_MODEL_FACTOR_COLUMN, &factor,
|
||||
-1);
|
||||
|
||||
if (gconf_value == (float) (factor * x_dpi))
|
||||
{
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter);
|
||||
break;
|
||||
}
|
||||
|
||||
valid = gtk_tree_model_iter_next (model, &iter);
|
||||
}
|
||||
|
||||
/* if a matching value was not found in the combobox, set to "normal" */
|
||||
if (!valid)
|
||||
{
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dpi_combo_box_changed (GtkComboBox *box,
|
||||
CcUaPanel *panel)
|
||||
{
|
||||
CcUaPanelPrivate *priv = panel->priv;
|
||||
GtkTreeIter iter;
|
||||
gfloat factor;
|
||||
|
||||
gtk_combo_box_get_active_iter (box, &iter);
|
||||
|
||||
gtk_tree_model_get (gtk_combo_box_get_model (box), &iter,
|
||||
DPI_MODEL_FACTOR_COLUMN, &factor,
|
||||
-1);
|
||||
|
||||
if (factor == 1.0)
|
||||
gconf_client_unset (priv->client, DPI_KEY, NULL);
|
||||
else
|
||||
{
|
||||
gdouble x_dpi, u_dpi;
|
||||
|
||||
x_dpi = get_dpi_from_x_server ();
|
||||
u_dpi = (gdouble) factor * x_dpi;
|
||||
|
||||
gconf_client_set_float (priv->client, DPI_KEY, u_dpi, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
contrast_notify_cb (GConfClient *client,
|
||||
guint cnxn_id,
|
||||
GConfEntry *entry,
|
||||
CcUaPanel *panel)
|
||||
{
|
||||
CcUaPanelPrivate *priv = panel->priv;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
GtkWidget *combo;
|
||||
gboolean valid;
|
||||
gchar *gconf_value;
|
||||
|
||||
gconf_value = gconf_client_get_string (client, GTK_THEME_KEY, NULL);
|
||||
|
||||
combo = WID (priv->builder, "seeing_contrast_combobox");
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
|
||||
|
||||
/* see if there is a matching theme name in the combobox model */
|
||||
valid = gtk_tree_model_get_iter_first (model, &iter);
|
||||
while (valid)
|
||||
{
|
||||
gchar *value;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
CONTRAST_MODEL_THEME_COLUMN, &value,
|
||||
-1);
|
||||
|
||||
if (!g_strcmp0 (value, gconf_value))
|
||||
{
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter);
|
||||
g_free (value);
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (value);
|
||||
valid = gtk_tree_model_iter_next (model, &iter);
|
||||
}
|
||||
|
||||
/* if a value for the current theme was not found in the combobox, set to the
|
||||
* "normal" option */
|
||||
if (!valid)
|
||||
{
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
contrast_combobox_changed_cb (GtkComboBox *box,
|
||||
CcUaPanel *panel)
|
||||
{
|
||||
CcUaPanelPrivate *priv = panel->priv;
|
||||
gchar *theme_name = NULL;
|
||||
GtkTreeIter iter;
|
||||
|
||||
gtk_combo_box_get_active_iter (box, &iter);
|
||||
|
||||
gtk_tree_model_get (gtk_combo_box_get_model (box), &iter,
|
||||
CONTRAST_MODEL_THEME_COLUMN, &theme_name,
|
||||
-1);
|
||||
|
||||
if (g_strcmp0 (theme_name, ""))
|
||||
{
|
||||
gconf_client_set_string (priv->client, GTK_THEME_KEY, theme_name, NULL);
|
||||
gconf_client_set_string (priv->client, ICON_THEME_KEY, theme_name, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
gconf_client_unset (priv->client, GTK_THEME_KEY, NULL);
|
||||
gconf_client_unset (priv->client, ICON_THEME_KEY, NULL);
|
||||
}
|
||||
|
||||
g_free (theme_name);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_ua_panel_init_seeing (CcUaPanel *self)
|
||||
{
|
||||
CcUaPanelPrivate *priv = self->priv;
|
||||
guint id;
|
||||
|
||||
gconf_client_add_dir (priv->client, "/desktop/gnome/interface",
|
||||
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
gconf_client_add_dir (priv->client, "/desktop/gnome/font_rendering",
|
||||
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
|
||||
id = gconf_client_notify_add (priv->client, GTK_THEME_KEY,
|
||||
(GConfClientNotifyFunc) contrast_notify_cb,
|
||||
self, NULL, NULL);
|
||||
priv->notify_list = g_slist_prepend (priv->notify_list, GINT_TO_POINTER (id));
|
||||
|
||||
id = gconf_client_notify_add (priv->client, DPI_KEY,
|
||||
(GConfClientNotifyFunc) dpi_notify_cb,
|
||||
self, NULL, NULL);
|
||||
priv->notify_list = g_slist_prepend (priv->notify_list, GINT_TO_POINTER (id));
|
||||
|
||||
g_signal_connect (WID (priv->builder, "seeing_contrast_combobox"), "changed",
|
||||
G_CALLBACK (contrast_combobox_changed_cb), self);
|
||||
gconf_client_notify (priv->client, GTK_THEME_KEY);
|
||||
|
||||
g_signal_connect (WID (priv->builder, "seeing_text_size_combobox"), "changed",
|
||||
G_CALLBACK (dpi_combo_box_changed), self);
|
||||
gconf_client_notify (priv->client, DPI_KEY);
|
||||
|
||||
gconf_peditor_new_boolean (NULL,
|
||||
"/desktop/gnome/accessibility/keyboard/togglekeys_enable",
|
||||
WID (priv->builder,
|
||||
"seeing_enable_toggle_keys_checkbutton"),
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
/* hearing/sound section */
|
||||
static void
|
||||
visual_bell_type_notify_cb (GConfClient *client,
|
||||
guint cnxn_id,
|
||||
GConfEntry *entry,
|
||||
CcUaPanel *panel)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
const gchar *value = gconf_value_get_string (entry->value);
|
||||
|
||||
if (!strcmp ("frame_flash", value))
|
||||
widget = WID (panel->priv->builder, "hearing_flash_window_title_button");
|
||||
else
|
||||
widget = WID (panel->priv->builder, "hearing_flash_screen_button");
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
visual_bell_type_toggle_cb (GtkWidget *button,
|
||||
CcUaPanel *panel)
|
||||
{
|
||||
const gchar *key = "/apps/metacity/general/visual_bell_type";
|
||||
gboolean window_title;
|
||||
|
||||
window_title = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
|
||||
|
||||
if (window_title)
|
||||
gconf_client_set_string (panel->priv->client, key, "frame_flash", NULL);
|
||||
else
|
||||
gconf_client_set_string (panel->priv->client, key, "fullscreen", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_ua_panel_init_hearing (CcUaPanel *self)
|
||||
{
|
||||
CcUaPanelPrivate *priv = self->priv;
|
||||
GtkWidget *w;
|
||||
GConfEntry *entry;
|
||||
guint id;
|
||||
|
||||
gconf_client_add_dir (priv->client, "/apps/metacity/general",
|
||||
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
|
||||
w = WID (priv->builder, "hearing_visual_alerts_on_radiobutton");
|
||||
gconf_on_off_peditor_new (priv, "/apps/metacity/general/visual_bell",
|
||||
w, visual_alerts_section);
|
||||
|
||||
/* visual bell type */
|
||||
id = gconf_client_notify_add (priv->client,
|
||||
"/apps/metacity/general/visual_bell_type",
|
||||
(GConfClientNotifyFunc)
|
||||
visual_bell_type_notify_cb,
|
||||
self, NULL, NULL);
|
||||
priv->notify_list = g_slist_prepend (priv->notify_list, GINT_TO_POINTER (id));
|
||||
|
||||
/* set the initial value */
|
||||
entry = gconf_client_get_entry (priv->client,
|
||||
"/apps/metacity/general/visual_bell_type",
|
||||
NULL, TRUE, NULL);
|
||||
visual_bell_type_notify_cb (priv->client, 0, entry, self);
|
||||
|
||||
g_signal_connect (WID (priv->builder, "hearing_flash_window_title_button"),
|
||||
"toggled", G_CALLBACK (visual_bell_type_toggle_cb), self);
|
||||
|
||||
/* test flash */
|
||||
g_signal_connect (WID (priv->builder, "hearing_test_flash_button"),
|
||||
"clicked", G_CALLBACK (gdk_beep), NULL);
|
||||
|
||||
}
|
||||
|
||||
/* typing/keyboard section */
|
||||
static void
|
||||
typing_keyboard_preferences_clicked (GtkButton *button,
|
||||
CcUaPanel *panel)
|
||||
{
|
||||
CcShell *shell;
|
||||
|
||||
shell = cc_panel_get_shell (CC_PANEL (panel));
|
||||
cc_shell_set_active_panel_from_id (shell, "keyboard", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_ua_panel_init_keyboard (CcUaPanel *self)
|
||||
{
|
||||
CcUaPanelPrivate *priv = self->priv;
|
||||
GConfChangeSet *changeset = NULL;
|
||||
GtkWidget *w;
|
||||
|
||||
|
||||
/* enable shortcuts */
|
||||
w = WID (priv->builder, "typing_keyboard_toggle_checkbox");
|
||||
gconf_peditor_new_boolean (changeset, KEY_CONFIG_ROOT "/enable", w, NULL);
|
||||
|
||||
/* sticky keys */
|
||||
w = WID (priv->builder, "typing_sticky_keys_on_radiobutton");
|
||||
gconf_on_off_peditor_new (priv, KEY_CONFIG_ROOT "/stickykeys_enable",
|
||||
w, sticky_keys_section);
|
||||
|
||||
w = WID (priv->builder, "typing_sticky_keys_disable_two_keys_checkbutton");
|
||||
gconf_peditor_new_boolean (changeset,
|
||||
KEY_CONFIG_ROOT "/stickykeys_two_key_off", w,
|
||||
NULL);
|
||||
|
||||
w = WID (priv->builder, "typing_sticky_keys_beep_modifier_checkbutton");
|
||||
gconf_peditor_new_boolean (changeset,
|
||||
KEY_CONFIG_ROOT "/stickykeys_modifier_beep", w,
|
||||
NULL);
|
||||
|
||||
/* slow keys */
|
||||
w = WID (priv->builder, "typing_slow_keys_on_radiobutton");
|
||||
gconf_on_off_peditor_new (priv, KEY_CONFIG_ROOT "/slowkeys_enable",
|
||||
w, slow_keys_section);
|
||||
|
||||
w = WID (priv->builder, "typing_slowkeys_delay_scale");
|
||||
gconf_peditor_new_numeric_range (changeset, KEY_CONFIG_ROOT "/slowkeys_delay",
|
||||
w, NULL);
|
||||
|
||||
w = WID (priv->builder, "typing_slow_keys_beep_pressed_checkbutton");
|
||||
gconf_peditor_new_boolean (changeset, KEY_CONFIG_ROOT "/slowkeys_beep_press",
|
||||
w, NULL);
|
||||
|
||||
w = WID (priv->builder, "typing_slow_keys_beep_accepted_checkbutton");
|
||||
gconf_peditor_new_boolean (changeset, KEY_CONFIG_ROOT "/slowkeys_beep_accept",
|
||||
w, NULL);
|
||||
|
||||
w = WID (priv->builder, "typing_slow_keys_beep_rejected_checkbutton");
|
||||
gconf_peditor_new_boolean (changeset, KEY_CONFIG_ROOT "/slowkeys_beep_reject",
|
||||
w, NULL);
|
||||
|
||||
/* bounce keys */
|
||||
w = WID (priv->builder, "typing_bounce_keys_on_radiobutton");
|
||||
gconf_on_off_peditor_new (priv, KEY_CONFIG_ROOT "/bouncekeys_enable", w,
|
||||
bounce_keys_section);
|
||||
|
||||
w = WID (priv->builder, "typing_bouncekeys_delay_scale");
|
||||
gconf_peditor_new_numeric_range (changeset,
|
||||
KEY_CONFIG_ROOT "/bouncekeys_delay", w,
|
||||
NULL);
|
||||
|
||||
w = WID (priv->builder, "typing_bounce_keys_beep_rejected_checkbutton");
|
||||
gconf_peditor_new_boolean (changeset,
|
||||
KEY_CONFIG_ROOT "/bouncekeys_beep_reject", w,
|
||||
NULL);
|
||||
|
||||
g_signal_connect (WID (priv->builder, "typing_keyboard_preferences_button"),
|
||||
"clicked",
|
||||
G_CALLBACK (typing_keyboard_preferences_clicked), self);
|
||||
}
|
||||
|
||||
/* mouse/pointing & clicking section */
|
||||
static void
|
||||
pointing_mouse_preferences_clicked_cb (GtkButton *button,
|
||||
CcUaPanel *panel)
|
||||
{
|
||||
CcShell *shell;
|
||||
|
||||
shell = cc_panel_get_shell (CC_PANEL (panel));
|
||||
cc_shell_set_active_panel_from_id (shell, "mouse", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_ua_panel_init_mouse (CcUaPanel *self)
|
||||
{
|
||||
CcUaPanelPrivate *priv = self->priv;
|
||||
GConfChangeSet *changeset = NULL;
|
||||
GtkWidget *w;
|
||||
|
||||
/* mouse keys */
|
||||
w = WID (priv->builder, "pointing_mouse_keys_on_radiobutton");
|
||||
gconf_on_off_peditor_new (priv, KEY_CONFIG_ROOT "/mousekeys_enable", w, NULL);
|
||||
|
||||
/* simulated secondary click */
|
||||
w = WID (priv->builder, "pointing_second_click_on_radiobutton");
|
||||
gconf_on_off_peditor_new (priv, MOUSE_CONFIG_ROOT "/delay_enable", w,
|
||||
secondary_click_section);
|
||||
|
||||
w = WID (priv->builder, "pointing_secondary_click_delay_scale");
|
||||
gconf_peditor_new_numeric_range (changeset,
|
||||
MOUSE_CONFIG_ROOT "/delay_time", w,
|
||||
NULL);
|
||||
|
||||
|
||||
/* dwell click */
|
||||
w = WID (priv->builder, "pointing_hover_click_on_radiobutton");
|
||||
gconf_on_off_peditor_new (priv,MOUSE_CONFIG_ROOT "/dwell_enable", w,
|
||||
dwell_click_section);
|
||||
|
||||
w = WID (priv->builder, "pointing_dwell_delay_scale");
|
||||
gconf_peditor_new_numeric_range (changeset,
|
||||
MOUSE_CONFIG_ROOT "/dwell_time", w,
|
||||
NULL);
|
||||
|
||||
w = WID (priv->builder, "pointing_dwell_threshold_scale");
|
||||
gconf_peditor_new_numeric_range (changeset,
|
||||
MOUSE_CONFIG_ROOT "/threshold", w,
|
||||
NULL);
|
||||
|
||||
/* mouse preferences button */
|
||||
g_signal_connect (WID (priv->builder, "pointing_mouse_preferences_button"),
|
||||
"clicked",
|
||||
G_CALLBACK (pointing_mouse_preferences_clicked_cb), self);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_ua_panel_init (CcUaPanel *self)
|
||||
{
|
||||
CcUaPanelPrivate *priv;
|
||||
GtkWidget *widget;
|
||||
GError *err = NULL;
|
||||
gchar *objects[] = { "universal_access_box", "contrast_model",
|
||||
"text_size_model", "slowkeys_delay_adjustment",
|
||||
"bouncekeys_delay_adjustment", "click_delay_adjustment",
|
||||
"dwell_time_adjustment", "dwell_threshold_adjustment",
|
||||
"NULL" };
|
||||
|
||||
priv = self->priv = UA_PANEL_PRIVATE (self);
|
||||
|
||||
priv->builder = gtk_builder_new ();
|
||||
|
||||
gtk_builder_add_objects_from_file (priv->builder,
|
||||
GNOMECC_DATA_DIR "/ui/uap.ui",
|
||||
objects,
|
||||
&err);
|
||||
|
||||
if (err)
|
||||
{
|
||||
g_warning ("Could not load interface file: %s", err->message);
|
||||
g_error_free (err);
|
||||
|
||||
g_object_unref (priv->builder);
|
||||
priv->builder = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
priv->client = gconf_client_get_default ();
|
||||
|
||||
gconf_client_add_dir (priv->client, CONFIG_ROOT,
|
||||
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
|
||||
cc_ua_panel_init_keyboard (self);
|
||||
cc_ua_panel_init_mouse (self);
|
||||
cc_ua_panel_init_hearing (self);
|
||||
cc_ua_panel_init_seeing (self);
|
||||
|
||||
widget = (GtkWidget*) gtk_builder_get_object (priv->builder,
|
||||
"universal_access_box");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (self), widget);
|
||||
}
|
||||
|
||||
void
|
||||
cc_ua_panel_register (GIOModule *module)
|
||||
{
|
||||
cc_ua_panel_register_type (G_TYPE_MODULE (module));
|
||||
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
|
||||
CC_TYPE_UA_PANEL,
|
||||
"universal-access", 0);
|
||||
}
|
||||
|
||||
75
panels/universal-access/cc-ua-panel.h
Normal file
75
panels/universal-access/cc-ua-panel.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
||||
*
|
||||
* Copyright (C) 2010 Intel, Inc
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Author: Thomas Wood <thomas.wood@intel.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CC_UA_PANEL_H
|
||||
#define _CC_UA_PANEL_H
|
||||
|
||||
#include <libgnome-control-center/cc-panel.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CC_TYPE_UA_PANEL cc_ua_panel_get_type()
|
||||
|
||||
#define CC_UA_PANEL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
CC_TYPE_UA_PANEL, CcUaPanel))
|
||||
|
||||
#define CC_UA_PANEL_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
CC_TYPE_UA_PANEL, CcUaPanelClass))
|
||||
|
||||
#define CC_IS_UA_PANEL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
||||
CC_TYPE_UA_PANEL))
|
||||
|
||||
#define CC_IS_UA_PANEL_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
||||
CC_TYPE_UA_PANEL))
|
||||
|
||||
#define CC_UA_PANEL_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
||||
CC_TYPE_UA_PANEL, CcUaPanelClass))
|
||||
|
||||
typedef struct _CcUaPanel CcUaPanel;
|
||||
typedef struct _CcUaPanelClass CcUaPanelClass;
|
||||
typedef struct _CcUaPanelPrivate CcUaPanelPrivate;
|
||||
|
||||
struct _CcUaPanel
|
||||
{
|
||||
CcPanel parent;
|
||||
|
||||
CcUaPanelPrivate *priv;
|
||||
};
|
||||
|
||||
struct _CcUaPanelClass
|
||||
{
|
||||
CcPanelClass parent_class;
|
||||
};
|
||||
|
||||
GType cc_ua_panel_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void cc_ua_panel_register (GIOModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _CC_UA_PANEL_H */
|
||||
11
panels/universal-access/gnome-universal-access.desktop.in.in
Normal file
11
panels/universal-access/gnome-universal-access.desktop.in.in
Normal file
@@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
_Name=Universal Access
|
||||
_Comment=Universal Access Preferences
|
||||
Exec=gnome-example-properties
|
||||
Icon=preferences-desktop-accessibility
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=true
|
||||
Categories=GNOME;GTK;Settings;DesktopSettings;
|
||||
OnlyShowIn=GNOME;
|
||||
X-GNOME-Settings-Panel=universal-access
|
||||
2830
panels/universal-access/uap.ui
Normal file
2830
panels/universal-access/uap.ui
Normal file
File diff suppressed because it is too large
Load Diff
42
panels/universal-access/universal-access-module.c
Normal file
42
panels/universal-access/universal-access-module.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
||||
*
|
||||
* Copyright (C) 2010 Intel, Inc
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Author: Thomas Wood <thomas.wood@intel.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cc-ua-panel.h"
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
void
|
||||
g_io_module_load (GIOModule *module)
|
||||
{
|
||||
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
|
||||
/* register the panel */
|
||||
cc_ua_panel_register (module);
|
||||
}
|
||||
|
||||
void
|
||||
g_io_module_unload (GIOModule *module)
|
||||
{
|
||||
}
|
||||
@@ -22,6 +22,9 @@
|
||||
#include "cc-shell-model.h"
|
||||
#include <string.h>
|
||||
|
||||
#define GNOME_SETTINGS_PANEL_ID_KEY "X-GNOME-Settings-Panel"
|
||||
|
||||
|
||||
G_DEFINE_TYPE (CcShellModel, cc_shell_model, GTK_TYPE_LIST_STORE)
|
||||
|
||||
static void
|
||||
@@ -53,14 +56,30 @@ cc_shell_model_add_item (CcShellModel *model,
|
||||
{
|
||||
const gchar *icon = gmenu_tree_entry_get_icon (item);
|
||||
const gchar *name = gmenu_tree_entry_get_name (item);
|
||||
const gchar *id = gmenu_tree_entry_get_desktop_file_id (item);
|
||||
const gchar *desktop = gmenu_tree_entry_get_desktop_file_path (item);
|
||||
const gchar *comment = gmenu_tree_entry_get_comment (item);
|
||||
gchar *id;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
gchar *icon2 = NULL;
|
||||
GError *err = NULL;
|
||||
gchar *search_target;
|
||||
GKeyFile *key_file;
|
||||
|
||||
/* load the .desktop file since gnome-menus doesn't have a way to read
|
||||
* custom properties from desktop files */
|
||||
|
||||
key_file = g_key_file_new ();
|
||||
g_key_file_load_from_file (key_file, desktop, 0, NULL);
|
||||
|
||||
id = g_key_file_get_string (key_file, "Desktop Entry",
|
||||
GNOME_SETTINGS_PANEL_ID_KEY, NULL);
|
||||
g_key_file_free (key_file);
|
||||
key_file = NULL;
|
||||
|
||||
if (!id)
|
||||
id = g_strdup (gmenu_tree_entry_get_desktop_file_id (item));
|
||||
|
||||
/* find the icon */
|
||||
if (icon != NULL && *icon == '/')
|
||||
{
|
||||
pixbuf = gdk_pixbuf_new_from_file_at_scale (icon, 32, 32, TRUE, &err);
|
||||
@@ -97,6 +116,6 @@ cc_shell_model_add_item (CcShellModel *model,
|
||||
COL_ICON_NAME, icon,
|
||||
-1);
|
||||
|
||||
g_free (id);
|
||||
g_free (search_target);
|
||||
|
||||
}
|
||||
|
||||
@@ -44,8 +44,6 @@ G_DEFINE_TYPE (GnomeControlCenter, gnome_control_center, CC_TYPE_SHELL)
|
||||
|
||||
#define W(b,x) GTK_WIDGET (gtk_builder_get_object (b, x))
|
||||
|
||||
#define GNOME_SETTINGS_PANEL_ID_KEY "X-GNOME-Settings-Panel"
|
||||
|
||||
enum
|
||||
{
|
||||
OVERVIEW_PAGE,
|
||||
@@ -79,7 +77,7 @@ struct _GnomeControlCenterPrivate
|
||||
|
||||
static void
|
||||
activate_panel (GnomeControlCenter *shell,
|
||||
const gchar *nid,
|
||||
const gchar *id,
|
||||
const gchar *desktop_file,
|
||||
const gchar *name,
|
||||
const gchar *icon_name)
|
||||
@@ -88,10 +86,9 @@ activate_panel (GnomeControlCenter *shell,
|
||||
GAppInfo *appinfo;
|
||||
GError *err = NULL;
|
||||
GdkAppLaunchContext *ctx;
|
||||
GKeyFile *key_file;
|
||||
GType panel_type = G_TYPE_INVALID;
|
||||
GList *panels, *l;
|
||||
gchar *panel_id;
|
||||
GKeyFile *key_file;
|
||||
|
||||
/* check if there is an plugin that implements this panel */
|
||||
panels = g_io_extension_point_get_extensions (priv->extension_point);
|
||||
@@ -99,13 +96,7 @@ activate_panel (GnomeControlCenter *shell,
|
||||
if (!desktop_file)
|
||||
return;
|
||||
|
||||
key_file = g_key_file_new ();
|
||||
g_key_file_load_from_file (key_file, desktop_file, 0, &err);
|
||||
|
||||
panel_id = g_key_file_get_string (key_file, "Desktop Entry",
|
||||
GNOME_SETTINGS_PANEL_ID_KEY, NULL);
|
||||
|
||||
if (panel_id)
|
||||
if (id)
|
||||
{
|
||||
|
||||
for (l = panels; l != NULL; l = l->next)
|
||||
@@ -117,16 +108,13 @@ activate_panel (GnomeControlCenter *shell,
|
||||
|
||||
name = g_io_extension_get_name (extension);
|
||||
|
||||
if (!g_strcmp0 (name, panel_id))
|
||||
if (!g_strcmp0 (name, id))
|
||||
{
|
||||
panel_type = g_io_extension_get_type (extension);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_free (panel_id);
|
||||
panel_id = NULL;
|
||||
|
||||
if (panel_type != G_TYPE_INVALID)
|
||||
{
|
||||
GtkWidget *panel;
|
||||
@@ -142,17 +130,16 @@ activate_panel (GnomeControlCenter *shell,
|
||||
gtk_container_add (GTK_CONTAINER (box), panel);
|
||||
|
||||
/* switch to the new panel */
|
||||
i = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), box, NULL);
|
||||
gtk_widget_show_all (box);
|
||||
i = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), box,
|
||||
NULL);
|
||||
gtk_widget_show (box);
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), i);
|
||||
|
||||
/* set the title of the window */
|
||||
gtk_window_set_title (GTK_WINDOW (priv->window), name);
|
||||
gtk_window_set_icon_name (GTK_WINDOW (priv->window), icon_name);
|
||||
|
||||
g_key_file_free (key_file);
|
||||
key_file = NULL;
|
||||
|
||||
gtk_widget_show (panel);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -167,12 +154,12 @@ activate_panel (GnomeControlCenter *shell,
|
||||
g_error_free (err);
|
||||
err = NULL;
|
||||
|
||||
g_key_file_free (key_file);
|
||||
key_file = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
key_file = g_key_file_new ();
|
||||
g_key_file_load_from_file (key_file, desktop_file, 0, &err);
|
||||
|
||||
appinfo = (GAppInfo*) g_desktop_app_info_new_from_keyfile (key_file);
|
||||
|
||||
g_key_file_free (key_file);
|
||||
@@ -717,26 +704,15 @@ _shell_set_active_panel_from_id (CcShell *shell,
|
||||
/* find the details for this item */
|
||||
while (iter_valid)
|
||||
{
|
||||
GKeyFile *key_file;
|
||||
gchar *id;
|
||||
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
|
||||
COL_NAME, &name,
|
||||
COL_DESKTOP_FILE, &desktop,
|
||||
COL_ICON_NAME, &icon_name,
|
||||
COL_ID, &id,
|
||||
-1);
|
||||
|
||||
/* load the .desktop file since gnome-menus doesn't have a way to read
|
||||
* custom properties from desktop files */
|
||||
|
||||
key_file = g_key_file_new ();
|
||||
g_key_file_load_from_file (key_file, desktop, 0, NULL);
|
||||
|
||||
id = g_key_file_get_string (key_file, "Desktop Entry",
|
||||
GNOME_SETTINGS_PANEL_ID_KEY, NULL);
|
||||
g_key_file_free (key_file);
|
||||
key_file = NULL;
|
||||
|
||||
if (id && !strcmp (id, start_id))
|
||||
{
|
||||
g_free (id);
|
||||
|
||||
Reference in New Issue
Block a user