fix compiler warnings (closes bug #438152)
2007-07-01 Jens Granseuer <jensgr@gmx.net> * factory.c: (main): * gnome-settings-keybindings.c: * gnome-settings-mouse.c: * gnome-settings-screensaver.c: (key_toggled_cb): * gnome-settings-xrdb.c: fix compiler warnings (closes bug #438152) svn path=/trunk/; revision=7811
This commit is contained in:
parent
2d521a0b6e
commit
d69ad6a3fc
6 changed files with 70 additions and 59 deletions
|
@ -1,3 +1,11 @@
|
|||
2007-07-01 Jens Granseuer <jensgr@gmx.net>
|
||||
|
||||
* factory.c: (main):
|
||||
* gnome-settings-keybindings.c:
|
||||
* gnome-settings-mouse.c:
|
||||
* gnome-settings-screensaver.c: (key_toggled_cb):
|
||||
* gnome-settings-xrdb.c: fix compiler warnings (closes bug #438152)
|
||||
|
||||
2007-06-29 Jens Granseuer <jensgr@gmx.net>
|
||||
|
||||
* actions/acme.glade:
|
||||
|
|
|
@ -17,7 +17,7 @@ int main (int argc, char *argv [])
|
|||
{
|
||||
GnomeProgram *program;
|
||||
GnomeClient *session;
|
||||
GnomeSettingsDaemon *settings_daemon;
|
||||
GObject *settings_daemon;
|
||||
gchar *restart_argv[] = { "gnome-settings-daemon", NULL, NULL };
|
||||
|
||||
restart_argv[1] = *argv;
|
||||
|
@ -32,8 +32,8 @@ int main (int argc, char *argv [])
|
|||
argc, argv,
|
||||
GNOME_CLIENT_PARAM_SM_CONNECT, FALSE,
|
||||
NULL);
|
||||
|
||||
gconf_init (argc, argv, NULL); /* exits w/ message on failure */
|
||||
|
||||
gconf_init (argc, argv, NULL); /* exits w/ message on failure */
|
||||
|
||||
if (!(settings_daemon = gnome_settings_daemon_new ()))
|
||||
return 1;
|
||||
|
|
|
@ -7,13 +7,14 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include "gnome-settings-module.h"
|
||||
#include "utils.h"
|
||||
#include "eggaccelerators.h"
|
||||
|
||||
/* we exclude shift, GDK_CONTROL_MASK and GDK_MOD1_MASK since we know what
|
||||
these modifiers mean
|
||||
/* we exclude shift, GDK_CONTROL_MASK and GDK_MOD1_MASK since we know what
|
||||
these modifiers mean
|
||||
these are the mods whose combinations are bound by the keygrabbing code */
|
||||
#define IGNORED_MODS (0x2000 /*Xkb modifier*/ | GDK_LOCK_MASK | \
|
||||
GDK_MOD2_MASK | GDK_MOD3_MASK | GDK_MOD4_MASK | GDK_MOD5_MASK)
|
||||
GDK_MOD2_MASK | GDK_MOD3_MASK | GDK_MOD4_MASK | GDK_MOD5_MASK)
|
||||
/* these are the ones we actually use for global keys, we always only check
|
||||
* for these set */
|
||||
#define USED_MODS (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)
|
||||
|
@ -200,7 +201,7 @@ get_exec_environment (XEvent *xevent)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static gint
|
||||
static gint
|
||||
compare_bindings (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
Binding *key_a = (Binding*) a;
|
||||
|
@ -239,7 +240,7 @@ entry_get_string (GConfEntry *entry)
|
|||
return g_strdup (gconf_value_get_string (value));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static gboolean
|
||||
bindings_get_entry (const char *subdir)
|
||||
{
|
||||
Binding *new_binding;
|
||||
|
@ -249,9 +250,9 @@ bindings_get_entry (const char *subdir)
|
|||
char *key = NULL;
|
||||
gboolean ret = FALSE;
|
||||
GConfClient *client = gnome_settings_get_config_client ();
|
||||
|
||||
|
||||
g_return_val_if_fail (subdir != NULL, FALSE);
|
||||
|
||||
|
||||
/* value = gconf_entry_get_value (entry); */
|
||||
gconf_key = g_path_get_basename (subdir);
|
||||
|
||||
|
@ -284,11 +285,11 @@ bindings_get_entry (const char *subdir)
|
|||
gconf_entry_free (entry);
|
||||
}
|
||||
|
||||
if (!action || !key) {
|
||||
if (!action || !key) {
|
||||
g_warning (_("Key Binding (%s) is incomplete\n"), gconf_key);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
tmp_elem = g_slist_find_custom (binding_list, gconf_key,
|
||||
compare_bindings);
|
||||
|
||||
|
@ -299,7 +300,7 @@ bindings_get_entry (const char *subdir)
|
|||
g_free (new_binding->binding_str);
|
||||
g_free (new_binding->action);
|
||||
}
|
||||
|
||||
|
||||
new_binding->binding_str = key;
|
||||
new_binding->action = action;
|
||||
new_binding->gconf_key = gconf_key;
|
||||
|
@ -322,11 +323,11 @@ bindings_get_entry (const char *subdir)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static gboolean
|
||||
key_already_used (Binding *binding)
|
||||
{
|
||||
GSList *li;
|
||||
|
||||
|
||||
for (li = binding_list; li != NULL; li = li->next) {
|
||||
Binding *tmp_binding = (Binding*) li->data;
|
||||
|
||||
|
@ -364,7 +365,7 @@ do_grab (gboolean grab,
|
|||
int i, bit, bits_set_cnt;
|
||||
int uppervalue;
|
||||
guint mask_to_traverse = IGNORED_MODS & ~ key->state;
|
||||
|
||||
|
||||
bit = 0;
|
||||
for (i = 0; i < N_BITS; i++) {
|
||||
if (mask_to_traverse & (1<<i))
|
||||
|
@ -395,14 +396,14 @@ static void
|
|||
binding_register_keys (void)
|
||||
{
|
||||
GSList *li;
|
||||
|
||||
|
||||
gdk_error_trap_push();
|
||||
|
||||
/* Now check for changes and grab new key if not already used */
|
||||
for (li = binding_list ; li != NULL; li = li->next) {
|
||||
Binding *binding = (Binding *) li->data;
|
||||
|
||||
if (binding->previous_key.keycode != binding->key.keycode ||
|
||||
|
||||
if (binding->previous_key.keycode != binding->key.keycode ||
|
||||
binding->previous_key.state != binding->key.state) {
|
||||
/* Ungrab key if it changed and not clashing with previously set binding */
|
||||
if (!key_already_used (binding)) {
|
||||
|
@ -426,14 +427,14 @@ bindings_callback (GConfEntry *entry)
|
|||
{
|
||||
/* ensure we get binding dir not a sub component */
|
||||
gchar** key_elems = g_strsplit (gconf_entry_get_key (entry), "/", 15);
|
||||
gchar* binding_entry = g_strdup_printf ("/%s/%s/%s/%s", key_elems[1],
|
||||
key_elems[2], key_elems[3],
|
||||
key_elems[4]);
|
||||
gchar* binding_entry = g_strdup_printf ("/%s/%s/%s/%s", key_elems[1],
|
||||
key_elems[2], key_elems[3],
|
||||
key_elems[4]);
|
||||
g_strfreev (key_elems);
|
||||
|
||||
|
||||
bindings_get_entry (binding_entry);
|
||||
g_free (binding_entry);
|
||||
|
||||
|
||||
binding_register_keys ();
|
||||
}
|
||||
|
||||
|
@ -451,10 +452,10 @@ keybindings_filter (GdkXEvent *gdk_xevent,
|
|||
|
||||
keycode = xevent->xkey.keycode;
|
||||
state = xevent->xkey.state;
|
||||
|
||||
|
||||
for (li = binding_list; li != NULL; li = li->next) {
|
||||
Binding *binding = (Binding*) li->data;
|
||||
|
||||
|
||||
if (keycode == binding->key.keycode &&
|
||||
(state & USED_MODS) == binding->key.state) {
|
||||
GError* error = NULL;
|
||||
|
@ -509,7 +510,7 @@ gnome_settings_module_keybindings_initialize (GnomeSettingsModule *module, GConf
|
|||
int i;
|
||||
|
||||
gnome_settings_register_config_callback (GCONF_BINDING_DIR, bindings_callback);
|
||||
|
||||
|
||||
for (i = 0; i < screen_num; i++) {
|
||||
screen = gdk_display_get_screen (dpy, i);
|
||||
gdk_window_add_filter (gdk_screen_get_root_window (screen),
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "gnome-settings-locate-pointer.h"
|
||||
#include "gnome-settings-module.h"
|
||||
#include "utils.h"
|
||||
|
||||
typedef struct {
|
||||
GnomeSettingsModule parent;
|
||||
|
@ -51,7 +52,7 @@ GType
|
|||
gnome_settings_module_mouse_get_type (void)
|
||||
{
|
||||
static GType module_type = 0;
|
||||
|
||||
|
||||
if (!module_type) {
|
||||
static const GTypeInfo module_info = {
|
||||
sizeof (GnomeSettingsModuleMouseClass),
|
||||
|
@ -64,12 +65,12 @@ gnome_settings_module_mouse_get_type (void)
|
|||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gnome_settings_module_mouse_init,
|
||||
};
|
||||
|
||||
|
||||
module_type = g_type_register_static (GNOME_SETTINGS_TYPE_MODULE,
|
||||
"GnomeSettingsModuleMouse",
|
||||
&module_info, 0);
|
||||
}
|
||||
|
||||
|
||||
return module_type;
|
||||
}
|
||||
|
||||
|
@ -114,7 +115,7 @@ configure_button_layout (guchar *buttons,
|
|||
*/
|
||||
|
||||
/* check if the current mapping satisfies the above assumptions */
|
||||
if (buttons[left_button - 1] != left_button &&
|
||||
if (buttons[left_button - 1] != left_button &&
|
||||
buttons[left_button - 1] != right_button)
|
||||
/* The current mapping is weird. Swapping buttons is probably not a
|
||||
* good idea.
|
||||
|
@ -164,7 +165,7 @@ xinput_device_has_buttons (XDeviceInfo *device_info)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
class_info = (XAnyClassInfo *) (((guchar *) class_info) +
|
||||
class_info = (XAnyClassInfo *) (((guchar *) class_info) +
|
||||
class_info->length);
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -186,7 +187,7 @@ set_xinput_devices_left_handed (gboolean left_handed)
|
|||
buttons = g_new (guchar, buttons_capacity);
|
||||
else
|
||||
buttons = NULL;
|
||||
|
||||
|
||||
for (i = 0; i < n_devices; i++) {
|
||||
XDevice *device = NULL;
|
||||
|
||||
|
@ -203,21 +204,21 @@ set_xinput_devices_left_handed (gboolean left_handed)
|
|||
continue;
|
||||
|
||||
n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY (), device,
|
||||
buttons,
|
||||
buttons,
|
||||
buttons_capacity);
|
||||
|
||||
while (n_buttons > buttons_capacity) {
|
||||
buttons_capacity = n_buttons;
|
||||
buttons = (guchar *) g_realloc (buttons,
|
||||
buttons = (guchar *) g_realloc (buttons,
|
||||
buttons_capacity * sizeof (guchar));
|
||||
|
||||
n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY (), device,
|
||||
buttons,
|
||||
buttons,
|
||||
buttons_capacity);
|
||||
}
|
||||
|
||||
configure_button_layout (buttons, n_buttons, left_handed);
|
||||
|
||||
|
||||
XSetDeviceButtonMapping (GDK_DISPLAY (), device, buttons, n_buttons);
|
||||
XCloseDevice (GDK_DISPLAY (), device);
|
||||
}
|
||||
|
@ -241,11 +242,11 @@ set_left_handed (gboolean left_handed)
|
|||
#endif
|
||||
|
||||
buttons = g_new (guchar, buttons_capacity);
|
||||
n_buttons = XGetPointerMapping (GDK_DISPLAY (), buttons,
|
||||
n_buttons = XGetPointerMapping (GDK_DISPLAY (), buttons,
|
||||
(gint) buttons_capacity);
|
||||
while (n_buttons > buttons_capacity) {
|
||||
buttons_capacity = n_buttons;
|
||||
buttons = (guchar *) g_realloc (buttons,
|
||||
buttons = (guchar *) g_realloc (buttons,
|
||||
buttons_capacity * sizeof (guchar));
|
||||
|
||||
n_buttons = XGetPointerMapping (GDK_DISPLAY (), buttons,
|
||||
|
@ -323,7 +324,7 @@ filter (GdkXEvent *xevent,
|
|||
gint group;
|
||||
|
||||
GdkScreen *screen = (GdkScreen *)data;
|
||||
|
||||
|
||||
if (xev->type == KeyPress ||
|
||||
xev->type == KeyRelease) {
|
||||
/* get the keysym */
|
||||
|
@ -451,7 +452,7 @@ set_locate_pointer (gboolean locate_pointer)
|
|||
filter,
|
||||
screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ static void
|
|||
key_toggled_cb (GtkWidget *toggle, gpointer data)
|
||||
{
|
||||
GConfClient *client;
|
||||
GnomeSettingsModuleScreensaver *module_ss = data;
|
||||
GnomeSettingsModule *module_ss = data;
|
||||
|
||||
client = gnome_settings_module_get_config_client (module_ss);
|
||||
gconf_client_set_bool (client,
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <gtk/gtkwindow.h>
|
||||
|
||||
#include "gnome-settings-module.h"
|
||||
#include "utils.h"
|
||||
|
||||
typedef struct {
|
||||
GnomeSettingsModule parent;
|
||||
|
@ -82,15 +83,15 @@ static GdkColor*
|
|||
colour_shade (GdkColor *a, gdouble shade, GdkColor *b)
|
||||
{
|
||||
guint16 red, green, blue;
|
||||
|
||||
|
||||
red = CLAMP ((a->red) * shade, 0, 0xFFFF);
|
||||
green = CLAMP ((a->green) * shade, 0, 0xFFFF);
|
||||
blue = CLAMP ((a->blue) * shade, 0, 0xFFFF);
|
||||
|
||||
|
||||
b->red = red;
|
||||
b->green = green;
|
||||
b->blue = blue;
|
||||
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
|
@ -125,12 +126,12 @@ append_theme_colours (GtkStyle *style, GString *string)
|
|||
&style->base[GTK_STATE_NORMAL]);
|
||||
append_colour_define(string, "WINDOW_FOREGROUND",
|
||||
&style->text[GTK_STATE_NORMAL]);
|
||||
|
||||
|
||||
append_colour_define(string, "INACTIVE_BACKGROUND",
|
||||
&style->bg[GTK_STATE_INSENSITIVE]);
|
||||
append_colour_define(string, "INACTIVE_FOREGROUND",
|
||||
&style->text[GTK_STATE_INSENSITIVE]);
|
||||
|
||||
|
||||
append_colour_define(string, "ACTIVE_BACKGROUND",
|
||||
&style->bg[GTK_STATE_SELECTED]);
|
||||
append_colour_define(string, "ACTIVE_FOREGROUND",
|
||||
|
@ -218,13 +219,13 @@ static GSList*
|
|||
scan_for_files (GError **error)
|
||||
{
|
||||
const char* home_dir;
|
||||
|
||||
|
||||
GSList *user_list = NULL, *system_list = NULL;
|
||||
GSList *list = NULL, *p;
|
||||
|
||||
system_list = scan_ad_directory (SYSTEM_AD_DIR, error);
|
||||
if (*error) return NULL;
|
||||
|
||||
|
||||
home_dir = g_get_home_dir ();
|
||||
if (home_dir) {
|
||||
char *user_ad = g_build_filename (home_dir, USER_AD_DIR, NULL);
|
||||
|
@ -244,7 +245,7 @@ scan_for_files (GError **error)
|
|||
|
||||
/* An alternative approach would be to strdup() the strings
|
||||
and free the entire contents of these lists, but that is a
|
||||
little inefficient for my liking - RB */
|
||||
little inefficient for my liking - RB */
|
||||
for (p = system_list; p != NULL; p = g_slist_next (p)) {
|
||||
if (strcmp (p->data, GENERAL_AD) == 0) {
|
||||
/* We ignore this, free the data now */
|
||||
|
@ -331,10 +332,10 @@ apply_settings (GtkStyle *style)
|
|||
error = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
g_slist_foreach (list, (GFunc)g_free, NULL);
|
||||
g_slist_free (list);
|
||||
|
||||
|
||||
append_xresource_file (USER_X_RESOURCES, string, &error);
|
||||
append_xresource_file (USER_X_DEFAULTS, string, &error);
|
||||
|
||||
|
@ -360,7 +361,7 @@ GType
|
|||
gnome_settings_module_xrdb_get_type (void)
|
||||
{
|
||||
static GType module_type = 0;
|
||||
|
||||
|
||||
if (!module_type) {
|
||||
static const GTypeInfo module_info = {
|
||||
sizeof (GnomeSettingsModuleXrdbClass),
|
||||
|
@ -373,12 +374,12 @@ gnome_settings_module_xrdb_get_type (void)
|
|||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gnome_settings_module_xrdb_init,
|
||||
};
|
||||
|
||||
|
||||
module_type = g_type_register_static (GNOME_SETTINGS_TYPE_MODULE,
|
||||
"GnomeSettingsModuleXrdb",
|
||||
&module_info, 0);
|
||||
}
|
||||
|
||||
|
||||
return module_type;
|
||||
}
|
||||
|
||||
|
@ -400,9 +401,9 @@ gnome_settings_module_xrdb_start (GnomeSettingsModule *module)
|
|||
static gboolean initialized = FALSE;
|
||||
|
||||
if (!initialized) {
|
||||
/* the initialization is done here otherwise
|
||||
gnome_settings_xsettings_load would generate
|
||||
false hit as gtk-theme-name is set to Default in
|
||||
/* the initialization is done here otherwise
|
||||
gnome_settings_xsettings_load would generate
|
||||
false hit as gtk-theme-name is set to Default in
|
||||
gnome_settings_xsettings_init */
|
||||
GtkSettings *settings = gtk_settings_get_default ();
|
||||
widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
@ -410,7 +411,7 @@ gnome_settings_module_xrdb_start (GnomeSettingsModule *module)
|
|||
"notify::gtk-theme-name",
|
||||
G_CALLBACK (theme_changed),
|
||||
widget);
|
||||
gtk_widget_ensure_style (widget);
|
||||
gtk_widget_ensure_style (widget);
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue