From 688ec2f47167fcca1c3e14854b69640479422794 Mon Sep 17 00:00:00 2001 From: zhuyaliang <15132211195@163.com> Date: Tue, 24 Oct 2023 19:56:51 +0800 Subject: Remove compilation warning fix data type format error --- applets/brightness/brightness-applet.c | 20 +++++++++----------- applets/inhibit/inhibit-applet.c | 2 ++ src/egg-array-float.c | 6 +++--- src/egg-console-kit.c | 2 +- src/egg-idletime.c | 2 +- src/egg-test.c | 2 +- src/gpm-backlight.c | 24 ++++++++++++------------ src/gpm-brightness.c | 30 +++++++++++++++--------------- src/gpm-button.c | 8 ++++---- src/gpm-common.c | 4 ++++ src/gpm-engine.c | 8 ++++---- src/gpm-idle.c | 12 ++++++------ src/gpm-kbd-backlight.c | 2 +- src/gpm-manager.c | 10 ++++------ src/gpm-phone.c | 18 +++++++++++++----- src/gpm-prefs-core.c | 30 ++++++++++++++++-------------- src/gpm-session.c | 4 ++-- src/gpm-statistics.c | 34 ++++++++++++++++++---------------- src/gpm-tray-icon.c | 11 +++++++---- src/gpm-upower.c | 4 ++-- src/msd-osd-window.c | 13 ++++++++----- 21 files changed, 133 insertions(+), 113 deletions(-) diff --git a/applets/brightness/brightness-applet.c b/applets/brightness/brightness-applet.c index 125d45b..ff8f1ef 100644 --- a/applets/brightness/brightness-applet.c +++ b/applets/brightness/brightness-applet.c @@ -371,7 +371,7 @@ gpm_applet_update_tooltip (GpmBrightnessApplet *applet) } else if (applet->call_worked == FALSE) { buf = g_strdup (_("Cannot get laptop panel brightness")); } else { - buf = g_strdup_printf (_("LCD brightness : %d%%"), applet->level); + buf = g_strdup_printf (_("LCD brightness : %u%%"), applet->level); } gtk_widget_set_tooltip_text (GTK_WIDGET(applet), buf); } else { @@ -607,6 +607,10 @@ static void gpm_applet_create_popup (GpmBrightnessApplet *applet) { static GtkWidget *box, *frame; + GtkWidget *toplevel; + GtkStyleContext *context; + GdkScreen *screen; + GdkVisual *visual; gint orientation = mate_panel_applet_get_orient (MATE_PANEL_APPLET (MATE_PANEL_APPLET (applet))); gpm_applet_destroy_popup_cb (applet); @@ -664,13 +668,12 @@ gpm_applet_create_popup (GpmBrightnessApplet *applet) G_CALLBACK(gpm_applet_key_press_cb), applet); /* Set volume control frame, slider and toplevel window to follow panel volume control theme */ - GtkWidget *toplevel = gtk_widget_get_toplevel (frame); - GtkStyleContext *context; + toplevel = gtk_widget_get_toplevel (frame); context = gtk_widget_get_style_context (GTK_WIDGET(toplevel)); gtk_style_context_add_class(context,"mate-panel-applet-slider"); /*Make transparency possible in gtk3 theme3 */ - GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel)); - GdkVisual *visual = gdk_screen_get_rgba_visual(screen); + screen = gtk_widget_get_screen(GTK_WIDGET(toplevel)); + visual = gdk_screen_get_rgba_visual(screen); gtk_widget_set_visual(GTK_WIDGET(toplevel), visual); } @@ -702,11 +705,6 @@ gpm_applet_popup_cb (GpmBrightnessApplet *applet, GdkEventButton *event) return TRUE; } - /* don't show the popup if brightness is unavailable */ - if (applet->level == -1) { - return FALSE; - } - /* otherwise pop */ applet->popped = TRUE; @@ -899,7 +897,7 @@ brightness_changed_cb (DBusGProxy *proxy, guint brightness, GpmBrightnessApplet *applet) { - g_debug ("BrightnessChanged detected: %i\n", brightness); + g_debug ("BrightnessChanged detected: %u\n", brightness); applet->level = brightness; } diff --git a/applets/inhibit/inhibit-applet.c b/applets/inhibit/inhibit-applet.c index ab64597..02f1862 100644 --- a/applets/inhibit/inhibit-applet.c +++ b/applets/inhibit/inhibit-applet.c @@ -202,6 +202,8 @@ gpm_applet_size_allocate_cb (GtkWidget *widget, case MATE_PANEL_APPLET_ORIENT_DOWN: size = allocation->height; break; + default: + break; } /* Scale to the actual size of the applet, don't quantize to original icon size */ diff --git a/src/egg-array-float.c b/src/egg-array-float.c index 0c4d15c..e4c2a34 100644 --- a/src/egg-array-float.c +++ b/src/egg-array-float.c @@ -76,7 +76,7 @@ gfloat egg_array_float_get (EggArrayFloat *array, guint i) { if (i >= array->len) - g_error ("above index! (%i)", i); + g_error ("above index! (%u)", i); return g_array_index (array, gfloat, i); } @@ -150,7 +150,7 @@ egg_array_float_compute_gaussian (guint length, gfloat sigma) half_length = (length / 2) + 1; for (i=0; ilen; /* debug out */ for (i=0; ipriv->session_id, G_TYPE_INVALID); if (!ret) { - g_warning ("Failed to get session for pid %i: %s", pid, error->message); + g_warning ("Failed to get session for pid %u: %s", pid, error->message); g_error_free (error); goto out; } diff --git a/src/egg-idletime.c b/src/egg-idletime.c index b5a6c26..cbf869c 100644 --- a/src/egg-idletime.c +++ b/src/egg-idletime.c @@ -388,7 +388,7 @@ egg_idletime_init (EggIdletime *idletime) int ncounters; XSyncSystemCounter *counters; EggIdletimeAlarm *alarm; - guint i; + gint i; idletime->priv = egg_idletime_get_instance_private (idletime); diff --git a/src/egg-test.c b/src/egg-test.c index 1ca4acb..109bc47 100644 --- a/src/egg-test.c +++ b/src/egg-test.c @@ -45,7 +45,7 @@ struct EggTest { * egg_test_init: **/ EggTest * -egg_test_init () +egg_test_init (void) { EggTest *test; test = g_new (EggTest, 1); diff --git a/src/gpm-backlight.c b/src/gpm-backlight.c index cf9b06b..c4e95ab 100644 --- a/src/gpm-backlight.c +++ b/src/gpm-backlight.c @@ -158,7 +158,7 @@ gpm_backlight_set_brightness (GpmBacklight *backlight, guint percentage, GError } /* we emit a signal for the brightness applet */ if (ret && hw_changed) { - g_debug ("emitting brightness-changed : %i", percentage); + g_debug ("emitting brightness-changed : %u", percentage); g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage); } return ret; @@ -298,7 +298,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int if (on_battery && battery_reduce) { value = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_DIM_BATT); if (value > 100) { - g_warning ("cannot use battery brightness value %i, correcting to 50", value); + g_warning ("cannot use battery brightness value %u, correcting to 50", value); value = 50; } scale = (100 - value) / 100.0f; @@ -317,7 +317,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int if (enable_action && backlight->priv->system_is_idle) { value = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_IDLE_BRIGHTNESS); if (value > 100) { - g_warning ("cannot use idle brightness value %i, correcting to 50", value); + g_warning ("cannot use idle brightness value %u, correcting to 50", value); value = 50; } scale = value / 100.0f; @@ -348,7 +348,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int ret = gpm_brightness_set (backlight->priv->brightness, value, &hw_changed); /* we emit a signal for the brightness applet */ if (ret && hw_changed) { - g_debug ("emitting brightness-changed : %i", value); + g_debug ("emitting brightness-changed : %u", value); g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, value); } return TRUE; @@ -437,14 +437,14 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli /* if using AC power supply, save the new brightness settings */ g_object_get (backlight->priv->client, "on-battery", &on_battery, NULL); if (!on_battery) { - g_debug ("saving brightness for ac supply: %i", percentage); + g_debug ("saving brightness for ac supply: %u", percentage); g_settings_set_double (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_AC, percentage*1.0); } } /* we emit a signal for the brightness applet */ if (ret && hw_changed) { - g_debug ("emitting brightness-changed : %i", percentage); + g_debug ("emitting brightness-changed : %u", percentage); g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage); } } else if (g_strcmp0 (type, GPM_BUTTON_BRIGHT_DOWN) == 0) { @@ -463,14 +463,14 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli /* if using AC power supply, save the new brightness settings */ g_object_get (backlight->priv->client, "on-battery", &on_battery, NULL); if (!on_battery) { - g_debug ("saving brightness for ac supply: %i", percentage); + g_debug ("saving brightness for ac supply: %u", percentage); g_settings_set_double (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_AC, percentage*1.0); } } /* we emit a signal for the brightness applet */ if (ret && hw_changed) { - g_debug ("emitting brightness-changed : %i", percentage); + g_debug ("emitting brightness-changed : %u", percentage); g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage); } } else if (g_strcmp0 (type, GPM_BUTTON_LID_OPEN) == 0) { @@ -512,7 +512,7 @@ gpm_backlight_notify_system_idle_changed (GpmBacklight *backlight, gboolean is_i if (elapsed < 10) { /* double the event time */ backlight->priv->idle_dim_timeout *= 2.0; - g_debug ("increasing idle dim time to %is", backlight->priv->idle_dim_timeout); + g_debug ("increasing idle dim time to %us", backlight->priv->idle_dim_timeout); gpm_idle_set_timeout_dim (backlight->priv->idle, backlight->priv->idle_dim_timeout); } @@ -523,7 +523,7 @@ gpm_backlight_notify_system_idle_changed (GpmBacklight *backlight, gboolean is_i backlight->priv->idle_dim_timeout = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_IDLE_DIM_TIME); - g_debug ("resetting idle dim time to %is", backlight->priv->idle_dim_timeout); + g_debug ("resetting idle dim time to %us", backlight->priv->idle_dim_timeout); gpm_idle_set_timeout_dim (backlight->priv->idle, backlight->priv->idle_dim_timeout); } } else { @@ -606,7 +606,7 @@ idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *backlight) /* check if method is valid */ if (dpms_mode == GPM_DPMS_MODE_UNKNOWN || dpms_mode == GPM_DPMS_MODE_ON) { - g_warning ("BACKLIGHT method %i unknown. Using OFF.", dpms_mode); + g_warning ("BACKLIGHT method %u unknown. Using OFF.", dpms_mode); dpms_mode = GPM_DPMS_MODE_OFF; } @@ -635,7 +635,7 @@ brightness_changed_cb (GpmBrightness *brightness, guint percentage, GpmBacklight backlight->priv->master_percentage = percentage; /* we emit a signal for the brightness applet */ - g_debug ("emitting brightness-changed : %i", percentage); + g_debug ("emitting brightness-changed : %u", percentage); g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage); } diff --git a/src/gpm-brightness.c b/src/gpm-brightness.c index c35f028..a3a0589 100644 --- a/src/gpm-brightness.c +++ b/src/gpm-brightness.c @@ -239,7 +239,7 @@ gpm_brightness_output_set_internal (GpmBrightness *brightness, RROutput output, XFlush (brightness->priv->dpy); gdk_display_flush (display); if (gdk_x11_display_error_trap_pop (display)) { - g_warning ("failed to XRRChangeOutputProperty for brightness %i", value); + g_warning ("failed to XRRChangeOutputProperty for brightness %u", value); ret = FALSE; } /* we changed the hardware */ @@ -334,9 +334,9 @@ gpm_brightness_output_get_percentage (GpmBrightness *brightness, RROutput output ret = gpm_brightness_output_get_limits (brightness, output, &min, &max); if (!ret || min == max) return FALSE; - g_debug ("hard value=%i, min=%i, max=%i", cur, min, max); + g_debug ("hard value=%u, min=%u, max=%u", cur, min, max); percentage = egg_discrete_to_percent (cur, (max-min)+1); - g_debug ("percentage %i", percentage); + g_debug ("percentage %u", percentage); brightness->priv->shared_value = percentage; return TRUE; } @@ -360,14 +360,14 @@ gpm_brightness_output_down (GpmBrightness *brightness, RROutput output) ret = gpm_brightness_output_get_limits (brightness, output, &min, &max); if (!ret || min == max) return FALSE; - g_debug ("hard value=%i, min=%i, max=%i", cur, min, max); + g_debug ("hard value=%u, min=%u, max=%u", cur, min, max); if (cur == min) { g_debug ("already min"); return TRUE; } step = gpm_brightness_get_step ((max-min)+1); if (cur < step) { - g_debug ("truncating to %i", min); + g_debug ("truncating to %u", min); cur = min; } else { cur -= step; @@ -394,14 +394,14 @@ gpm_brightness_output_up (GpmBrightness *brightness, RROutput output) ret = gpm_brightness_output_get_limits (brightness, output, &min, &max); if (!ret || min == max) return FALSE; - g_debug ("hard value=%i, min=%i, max=%i", cur, min, max); + g_debug ("hard value=%u, min=%u, max=%u", cur, min, max); if (cur == max) { g_debug ("already max"); return TRUE; } cur += gpm_brightness_get_step ((max-min)+1); if (cur > max) { - g_debug ("truncating to %i", max); + g_debug ("truncating to %u", max); cur = max; } ret = gpm_brightness_output_set_internal (brightness, output, cur); @@ -431,15 +431,15 @@ gpm_brightness_output_set (GpmBrightness *brightness, RROutput output) return FALSE; shared_value_abs = egg_discrete_from_percent (brightness->priv->shared_value, (max-min)+1); - g_debug ("percent=%i, absolute=%i", brightness->priv->shared_value, shared_value_abs); + g_debug ("percent=%u, absolute=%i", brightness->priv->shared_value, shared_value_abs); - g_debug ("hard value=%i, min=%i, max=%i", cur, min, max); + g_debug ("hard value=%u, min=%u, max=%u", cur, min, max); if (shared_value_abs > (gint) max) shared_value_abs = max; if (shared_value_abs < (gint) min) shared_value_abs = min; if ((gint) cur == shared_value_abs) { - g_debug ("already set %i", cur); + g_debug ("already set %u", cur); return TRUE; } @@ -448,7 +448,7 @@ gpm_brightness_output_set (GpmBrightness *brightness, RROutput output) /* some adaptors have a large number of steps */ step = gpm_brightness_get_step (shared_value_abs - cur); - g_debug ("using step of %i", step); + g_debug ("using step of %u", step); /* going up */ for (i=cur; i<=shared_value_abs; i+=step) { @@ -462,7 +462,7 @@ gpm_brightness_output_set (GpmBrightness *brightness, RROutput output) /* some adaptors have a large number of steps */ step = gpm_brightness_get_step (cur - shared_value_abs); - g_debug ("using step of %i", step); + g_debug ("using step of %u", step); /* going down */ for (i=cur; i>=shared_value_abs; i-=step) { @@ -586,7 +586,7 @@ gpm_brightness_set (GpmBrightness *brightness, guint percentage, gboolean *hw_ch /* can we check the new value with the cache? */ trust_cache = gpm_brightness_trust_cache (brightness); if (trust_cache && percentage == brightness->priv->cache_percentage) { - g_debug ("not setting the same value %i", percentage); + g_debug ("not setting the same value %u", percentage); return TRUE; } @@ -656,7 +656,7 @@ gpm_brightness_get (GpmBrightness *brightness, guint *percentage) /* valid? */ if (percentage_local > 100) { - g_warning ("percentage value of %i will be truncated", percentage_local); + g_warning ("percentage value of %u will be truncated", percentage_local); percentage_local = 100; } @@ -786,7 +786,7 @@ gpm_brightness_may_have_changed (GpmBrightness *brightness) g_warning ("failed to get output"); return; } - g_debug ("emitting brightness-changed (%i)", percentage); + g_debug ("emitting brightness-changed (%u)", percentage); g_signal_emit (brightness, signals [BRIGHTNESS_CHANGED], 0, percentage); } diff --git a/src/gpm-button.c b/src/gpm-button.c index b751826..5bfe19d 100644 --- a/src/gpm-button.c +++ b/src/gpm-button.c @@ -110,12 +110,12 @@ gpm_button_filter_x_events (GdkXEvent *xevent, GdkEvent *event, gpointer data) /* found anything? */ if (key == NULL) { - g_debug ("Key %i not found in hash", keycode); + g_debug ("Key %u not found in hash", keycode); /* pass normal keypresses on, which might help with accessibility access */ return GDK_FILTER_CONTINUE; } - g_debug ("Key %i mapped to key %s", keycode, key); + g_debug ("Key %u mapped to key %s", keycode, key); gpm_button_emit_type (button, key); return GDK_FILTER_REMOVE; @@ -207,7 +207,7 @@ gpm_button_xevent_key (GpmButton *button, guint keysym, const gchar *key_name) keycode_str = g_strdup_printf ("0x%x", keycode); key = g_hash_table_lookup (button->priv->keysym_to_name_hash, (gpointer) keycode_str); if (key != NULL) { - g_warning ("found in hash %i", keycode); + g_warning ("found in hash %u", keycode); g_free (keycode_str); return FALSE; } @@ -215,7 +215,7 @@ gpm_button_xevent_key (GpmButton *button, guint keysym, const gchar *key_name) /* try to register X event */ ret = gpm_button_grab_keystring (button, keycode); if (!ret) { - g_warning ("Failed to grab %i", keycode); + g_warning ("Failed to grab %u", keycode); g_free (keycode_str); return FALSE; } diff --git a/src/gpm-common.c b/src/gpm-common.c index 7ee96be..481083c 100644 --- a/src/gpm-common.c +++ b/src/gpm-common.c @@ -208,8 +208,12 @@ gpm_notebook_scroll_event_cb (GtkWidget *widget, else if (event->delta_x < 0) gtk_notebook_prev_page (notebook); break; + default: + break; } break; + default: + break; } return TRUE; diff --git a/src/gpm-engine.c b/src/gpm-engine.c index 84be273..43d1321 100644 --- a/src/gpm-engine.c +++ b/src/gpm-engine.c @@ -704,13 +704,13 @@ phone_device_added_cb (GpmPhone *phone, guint idx, GpmEngine *engine) UpDevice *device; device = up_device_new (); - g_debug ("phone added %i", idx); + g_debug ("phone added %u", idx); /* get device properties */ g_object_set (device, "kind", UP_DEVICE_KIND_PHONE, "is-rechargeable", TRUE, - "native-path", g_strdup_printf ("dummy:phone_%i", idx), + "native-path", g_strdup_printf ("dummy:phone_%u", idx), "is-present", TRUE, NULL); @@ -730,7 +730,7 @@ phone_device_removed_cb (GpmPhone *phone, guint idx, GpmEngine *engine) UpDevice *device; UpDeviceKind kind; - g_debug ("phone removed %i", idx); + g_debug ("phone removed %u", idx); for (i=0; ipriv->array->len; i++) { device = g_ptr_array_index (engine->priv->array, i); @@ -763,7 +763,7 @@ phone_device_refresh_cb (GpmPhone *phone, guint idx, GpmEngine *engine) gboolean is_present; gdouble percentage; - g_debug ("phone refresh %i", idx); + g_debug ("phone refresh %u", idx); for (i=0; ipriv->array->len; i++) { device = g_ptr_array_index (engine->priv->array, i); diff --git a/src/gpm-idle.c b/src/gpm-idle.c index c4739da..9b8b0d1 100644 --- a/src/gpm-idle.c +++ b/src/gpm-idle.c @@ -223,7 +223,7 @@ gpm_idle_evaluate (GpmIdle *idle) * but only if we actually want to blank. */ if (idle->priv->timeout_blank_id == 0 && idle->priv->timeout_blank != 0) { - g_debug ("setting up blank callback for %is", idle->priv->timeout_blank); + g_debug ("setting up blank callback for %us", idle->priv->timeout_blank); idle->priv->timeout_blank_id = g_timeout_add_seconds (idle->priv->timeout_blank, (GSourceFunc) gpm_idle_blank_cb, idle); g_source_set_name_by_id (idle->priv->timeout_blank_id, "[GpmIdle] blank"); @@ -240,7 +240,7 @@ gpm_idle_evaluate (GpmIdle *idle) /* only do the sleep timeout when the session is idle and we aren't inhibited from sleeping */ if (idle->priv->timeout_sleep_id == 0 && idle->priv->timeout_sleep != 0) { - g_debug ("setting up sleep callback %is", idle->priv->timeout_sleep); + g_debug ("setting up sleep callback %us", idle->priv->timeout_sleep); idle->priv->timeout_sleep_id = g_timeout_add_seconds (idle->priv->timeout_sleep, (GSourceFunc) gpm_idle_sleep_cb, idle); g_source_set_name_by_id (idle->priv->timeout_sleep_id, "[GpmIdle] sleep"); @@ -297,7 +297,7 @@ gpm_idle_set_timeout_dim (GpmIdle *idle, guint timeout) (long long int)idle_time_in_msec, timeout, timeout_adjusted); timeout = timeout_adjusted; - g_debug ("Setting dim idle timeout: %ds", timeout); + g_debug ("Setting dim idle timeout: %us", timeout); if (idle->priv->timeout_dim != timeout) { idle->priv->timeout_dim = timeout; @@ -318,7 +318,7 @@ gpm_idle_set_timeout_blank (GpmIdle *idle, guint timeout) { g_return_val_if_fail (GPM_IS_IDLE (idle), FALSE); - g_debug ("Setting blank idle timeout: %ds", timeout); + g_debug ("Setting blank idle timeout: %us", timeout); if (idle->priv->timeout_blank != timeout) { idle->priv->timeout_blank = timeout; gpm_idle_evaluate (idle); @@ -335,7 +335,7 @@ gpm_idle_set_timeout_sleep (GpmIdle *idle, guint timeout) { g_return_val_if_fail (GPM_IS_IDLE (idle), FALSE); - g_debug ("Setting sleep idle timeout: %ds", timeout); + g_debug ("Setting sleep idle timeout: %us", timeout); if (idle->priv->timeout_sleep != timeout) { idle->priv->timeout_sleep = timeout; gpm_idle_evaluate (idle); @@ -375,7 +375,7 @@ gpm_idle_session_inhibited_changed_cb (GpmSession *session, gboolean is_idle_inh static void gpm_idle_idletime_alarm_expired_cb (EggIdletime *idletime, guint alarm_id, GpmIdle *idle) { - g_debug ("idletime alarm: %i", alarm_id); + g_debug ("idletime alarm: %u", alarm_id); /* set again */ idle->priv->x_idle = TRUE; diff --git a/src/gpm-kbd-backlight.c b/src/gpm-kbd-backlight.c index 2757f6e..a4353fe 100644 --- a/src/gpm-kbd-backlight.c +++ b/src/gpm-kbd-backlight.c @@ -139,7 +139,7 @@ gpm_kbd_backlight_set (GpmKbdBacklight *backlight, NULL, NULL); } - g_debug("Set brightness to %i", backlight->priv->brightness); + g_debug("Set brightness to %u", backlight->priv->brightness); return TRUE; } diff --git a/src/gpm-manager.c b/src/gpm-manager.c index 09e4f24..30cf92a 100644 --- a/src/gpm-manager.c +++ b/src/gpm-manager.c @@ -224,7 +224,7 @@ gpm_manager_play_loop_start (GpmManager *manager, GpmManagerSound action, gboole /* no match */ if (id == NULL) { - g_warning ("no sound match for %i", action); + g_warning ("no sound match for %u", action); return FALSE; } @@ -675,7 +675,7 @@ gpm_manager_perform_policy (GpmManager *manager, const gchar *policy_key, const return FALSE; policy = g_settings_get_enum (manager->priv->settings, policy_key); - g_debug ("action: %s set to %i (%s)", policy_key, policy, reason); + g_debug ("action: %s set to %u (%s)", policy_key, policy, reason); if (policy == GPM_ACTION_POLICY_NOTHING) { g_debug ("doing nothing, reason: %s", reason); @@ -699,7 +699,7 @@ gpm_manager_perform_policy (GpmManager *manager, const gchar *policy_key, const gpm_session_logout (session); g_object_unref (session); } else { - g_warning ("unknown action %i", policy); + g_warning ("unknown action %u", policy); } return TRUE; @@ -1672,7 +1672,7 @@ out: static void gpm_manager_dpms_mode_changed_cb (GpmDpms *dpms, GpmDpmsMode mode, GpmManager *manager) { - g_debug ("DPMS mode changed: %d", mode); + g_debug ("DPMS mode changed: %u", mode); if (mode == GPM_DPMS_MODE_ON) g_debug ("dpms on"); @@ -1816,12 +1816,10 @@ gpm_manager_init (GpmManager *manager) { gboolean check_type_cpu; DBusGConnection *connection; - GDBusConnection *g_connection; GError *error = NULL; manager->priv = gpm_manager_get_instance_private (manager); connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); - g_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); /* We want to inhibit the systemd suspend options, and take care of them ourselves */ if (LOGIND_RUNNING()) { diff --git a/src/gpm-phone.c b/src/gpm-phone.c index 0cd38f5..c5634ab 100644 --- a/src/gpm-phone.c +++ b/src/gpm-phone.c @@ -141,11 +141,11 @@ gpm_phone_battery_state_changed (DBusGProxy *proxy, guint idx, guint percentage, { g_return_if_fail (GPM_IS_PHONE (phone)); - g_debug ("got BatteryStateChanged %i = %i (%i)", idx, percentage, on_ac); + g_debug ("got BatteryStateChanged %u = %u (%i)", idx, percentage, on_ac); phone->priv->percentage = percentage; phone->priv->onac = on_ac; phone->priv->present = TRUE; - g_debug ("emitting device-refresh : (%i)", idx); + g_debug ("emitting device-refresh : (%u)", idx); g_signal_emit (phone, signals [DEVICE_REFRESH], 0, idx); } @@ -156,7 +156,7 @@ gpm_phone_num_batteries_changed (DBusGProxy *proxy, guint number, GpmPhone *phon { g_return_if_fail (GPM_IS_PHONE (phone)); - g_debug ("got NumberBatteriesChanged %i", number); + g_debug ("got NumberBatteriesChanged %u", number); if (number > 1) { g_warning ("number not 0 or 1, not valid!"); return; @@ -371,19 +371,27 @@ gpm_phone_new (void) static gboolean test_got_refresh = FALSE; +static gboolean +timeout_main_loop_quit (gpointer data) +{ + g_main_loop_quit (data); + + return FALSE; +} + static void egg_test_mainloop_wait (guint ms) { GMainLoop *loop; loop = g_main_loop_new (NULL, FALSE); - g_timeout_add (ms, (GSourceFunc) g_main_loop_quit, loop); + g_timeout_add (ms, (GSourceFunc) timeout_main_loop_quit, loop); g_main_loop_run (loop); } static void phone_device_refresh_cb (GpmPhone *phone, guint idx, gpointer *data) { - g_debug ("idx refresh = %i", idx); + g_debug ("idx refresh = %u", idx); if (idx == 0 && GPOINTER_TO_UINT (data) == 44) test_got_refresh = TRUE; } diff --git a/src/gpm-prefs-core.c b/src/gpm-prefs-core.c index 29ccfd0..d473ed6 100644 --- a/src/gpm-prefs-core.c +++ b/src/gpm-prefs-core.c @@ -190,7 +190,7 @@ gpm_prefs_action_time_changed_cb (GtkWidget *widget, GpmPrefs *prefs) active = gtk_combo_box_get_active (GTK_COMBO_BOX (widget)); value = values[active]; - g_debug ("Changing %s to %i", gpm_pref_key, value); + g_debug ("Changing %s to %u", gpm_pref_key, value); g_settings_set_int (prefs->priv->settings, gpm_pref_key, value); } @@ -214,7 +214,7 @@ static void gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name, const gchar *gpm_pref_key, const GpmActionPolicy *actions) { - gint i; + guint i; gboolean is_writable; GtkWidget *widget; GpmActionPolicy policy; @@ -234,7 +234,7 @@ gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name, g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (gpm_prefs_action_combo_changed_cb), prefs); - for (i=0; actions[i] != -1; i++) { + for (i=0; (gint)actions[i] != -1; i++) { policy = actions[i]; if (policy == GPM_ACTION_POLICY_SHUTDOWN && !prefs->priv->can_shutdown) { g_debug ("Cannot add option, as cannot shutdown."); @@ -261,7 +261,7 @@ gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name, gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Do nothing")); g_ptr_array_add(array, GINT_TO_POINTER (policy)); } else { - g_warning ("Unknown action read from settings: %i", policy); + g_warning ("Unknown action read from settings: %u", policy); } } @@ -274,7 +274,7 @@ gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name, g_object_set_data_full (G_OBJECT (widget), "actions", (gpointer) actions_added, (GDestroyNotify) gpm_prefs_actions_destroy_cb); /* set what we have in the settings */ - for (i=0; actions_added[i] != -1; i++) { + for (i=0; (gint)actions_added[i] != -1; i++) { policy = actions_added[i]; if (value == policy) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), i); @@ -322,7 +322,7 @@ gpm_prefs_setup_time_combo (GpmPrefs *prefs, const gchar *widget_name, } /* matches, so set default */ - if (value == values[i]) + if ((gint)value == values[i]) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), i); } @@ -587,6 +587,14 @@ gpm_prefs_init (GpmPrefs *prefs) UpDevice *device; UpDeviceKind kind; GpmBrightness *brightness; + gint icon_policy; + /** setup the notification page */ + GtkWidget *radiobutton_icon_always; + GtkWidget *radiobutton_icon_present; + GtkWidget *radiobutton_icon_charge; + GtkWidget *radiobutton_icon_low; + GtkWidget *radiobutton_icon_never; + guint i; GDBusProxy *proxy; @@ -747,14 +755,6 @@ gpm_prefs_init (GpmPrefs *prefs) gtk_widget_hide (GET_WIDGET ("button_defaults")); - /** setup the notification page */ - gint icon_policy; - GtkWidget *radiobutton_icon_always; - GtkWidget *radiobutton_icon_present; - GtkWidget *radiobutton_icon_charge; - GtkWidget *radiobutton_icon_low; - GtkWidget *radiobutton_icon_never; - icon_policy = g_settings_get_enum (prefs->priv->settings, GPM_SETTINGS_ICON_POLICY); radiobutton_icon_always = GET_WIDGET ("radiobutton_notification_always"); @@ -782,6 +782,8 @@ gpm_prefs_init (GpmPrefs *prefs) case GPM_ICON_POLICY_NEVER: gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton_icon_never), TRUE); break; + default: + break; } g_object_set_data (G_OBJECT (radiobutton_icon_always), "policy", GINT_TO_POINTER (GPM_ICON_POLICY_ALWAYS)); diff --git a/src/gpm-session.c b/src/gpm-session.c index bc577bb..9b5cc23 100644 --- a/src/gpm-session.c +++ b/src/gpm-session.c @@ -261,7 +261,7 @@ gpm_session_stop_cb (DBusGProxy *proxy, GpmSession *session) static void gpm_session_query_end_session_cb (DBusGProxy *proxy, guint flags, GpmSession *session) { - g_debug ("emitting ::query-end-session(%i)", flags); + g_debug ("emitting ::query-end-session(%u)", flags); g_signal_emit (session, signals [QUERY_END_SESSION], 0, flags); } @@ -271,7 +271,7 @@ gpm_session_query_end_session_cb (DBusGProxy *proxy, guint flags, GpmSession *se static void gpm_session_end_session_cb (DBusGProxy *proxy, guint flags, GpmSession *session) { - g_debug ("emitting ::end-session(%i)", flags); + g_debug ("emitting ::end-session(%u)", flags); g_signal_emit (session, signals [END_SESSION], 0, flags); } diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c index 0b7b9fc..aa25e8a 100644 --- a/src/gpm-statistics.c +++ b/src/gpm-statistics.c @@ -385,7 +385,7 @@ gpm_stats_update_info_page_details (UpDevice *device) gpm_stats_add_info_data (_("Supply"), gpm_stats_bool_to_string (power_supply)); refreshed = (int) (time (NULL) - update_time); - text = g_strdup_printf (ngettext ("%d second", "%d seconds", refreshed), refreshed); + text = g_strdup_printf (ngettext ("%u second", "%u seconds", refreshed), refreshed); /* TRANSLATORS: when the device was last updated with new data. It's * usually a few seconds when a device is discharging or charging. */ @@ -1206,7 +1206,7 @@ gpm_stats_highlight_device (const gchar *object_path) GPM_DEVICES_COLUMN_ID, &id, -1); if (g_strcmp0 (id, object_path) == 0) { - path_str = g_strdup_printf ("%i", i); + path_str = g_strdup_printf ("%u", i); path = gtk_tree_path_new_from_string (path_str); widget = GTK_WIDGET (gtk_builder_get_object (builder, "treeview_devices")); gtk_tree_view_set_cursor_on_cell (GTK_TREE_VIEW (widget), path, NULL, NULL, FALSE); @@ -1238,7 +1238,21 @@ main (int argc, char *argv[]) gint page; gboolean checked; gchar *last_device = NULL; + char *history_type_str; + char *stats_type_str; + const char *history_text [GPM_HISTORY_LAST_TYPE - 1] = { + [GPM_HISTORY_RATE_TYPE] = GPM_HISTORY_RATE_TEXT, + [GPM_HISTORY_CHARGE_TYPE] = GPM_HISTORY_CHARGE_TEXT, + [GPM_HISTORY_TIME_FULL_TYPE] = GPM_HISTORY_TIME_FULL_TEXT, + [GPM_HISTORY_TIME_EMPTY_TYPE] = GPM_HISTORY_TIME_EMPTY_TEXT + }; + const char *stats_text [GPM_STATS_LAST_TYPE] = { + [GPM_STATS_CHARGE_TYPE] = GPM_STATS_CHARGE_DATA_TEXT, + [GPM_STATS_DISCHARGE_TYPE] = GPM_STATS_DISCHARGE_DATA_TEXT, + [GPM_STATS_CHARGE_ACCURACY_TYPE] = GPM_STATS_CHARGE_ACCURACY_TEXT, + [GPM_STATS_DISCHARGE_ACCURACY_TYPE] = GPM_STATS_DISCHARGE_ACCURACY_TEXT + }; const GOptionEntry options[] = { { "device", '\0', 0, G_OPTION_ARG_STRING, &last_device, /* TRANSLATORS: show a device by default */ @@ -1369,7 +1383,7 @@ main (int argc, char *argv[]) gpm_stats_add_devices_columns (GTK_TREE_VIEW (widget)); gtk_tree_view_columns_autosize (GTK_TREE_VIEW (widget)); /* show */ - char *history_type_str = g_settings_get_string (settings, GPM_SETTINGS_INFO_HISTORY_TYPE); + history_type_str = g_settings_get_string (settings, GPM_SETTINGS_INFO_HISTORY_TYPE); if ((history_type_str == NULL) || (strcmp (history_type_str, GPM_HISTORY_CHARGE_VALUE) == 0)) { history_type = GPM_HISTORY_CHARGE_TYPE; } else if (strcmp (history_type_str, GPM_HISTORY_RATE_VALUE) == 0) { @@ -1389,7 +1403,7 @@ main (int argc, char *argv[]) if (history_time == 0) history_time = GPM_HISTORY_HOUR_VALUE; - char *stats_type_str = g_settings_get_string (settings, GPM_SETTINGS_INFO_STATS_TYPE); + stats_type_str = g_settings_get_string (settings, GPM_SETTINGS_INFO_STATS_TYPE); if ((stats_type_str == NULL) || (strcmp (stats_type_str, GPM_STATS_CHARGE_DATA_VALUE) == 0)) { stats_type = GPM_STATS_CHARGE_TYPE; } else if (strcmp (stats_type_str, GPM_STATS_DISCHARGE_DATA_VALUE) == 0) { @@ -1403,12 +1417,6 @@ main (int argc, char *argv[]) } g_free (stats_type_str); - const char *history_text [GPM_HISTORY_LAST_TYPE - 1] = { - [GPM_HISTORY_RATE_TYPE] = GPM_HISTORY_RATE_TEXT, - [GPM_HISTORY_CHARGE_TYPE] = GPM_HISTORY_CHARGE_TEXT, - [GPM_HISTORY_TIME_FULL_TYPE] = GPM_HISTORY_TIME_FULL_TEXT, - [GPM_HISTORY_TIME_EMPTY_TYPE] = GPM_HISTORY_TIME_EMPTY_TEXT - }; widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_history_type")); for (i = 0; i < GPM_HISTORY_LAST_TYPE - 1; i++) gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), history_text[i]); @@ -1419,12 +1427,6 @@ main (int argc, char *argv[]) g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (gpm_stats_history_type_combo_changed_cb), NULL); - const char *stats_text [GPM_STATS_LAST_TYPE] = { - [GPM_STATS_CHARGE_TYPE] = GPM_STATS_CHARGE_DATA_TEXT, - [GPM_STATS_DISCHARGE_TYPE] = GPM_STATS_DISCHARGE_DATA_TEXT, - [GPM_STATS_CHARGE_ACCURACY_TYPE] = GPM_STATS_CHARGE_ACCURACY_TEXT, - [GPM_STATS_DISCHARGE_ACCURACY_TYPE] = GPM_STATS_DISCHARGE_ACCURACY_TEXT - }; widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_stats_type")); for (i = 0; i < GPM_STATS_LAST_TYPE; i++) gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), stats_text[i]); diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c index d4055f1..607b762 100644 --- a/src/gpm-tray-icon.c +++ b/src/gpm-tray-icon.c @@ -338,6 +338,10 @@ gpm_tray_icon_create_menu (GpmTrayIcon *icon) guint dev_cnt = 0; GPtrArray *array; UpDevice *device = NULL; + GtkStyleContext *context; + GtkWidget *toplevel; + GdkScreen *screen; + GdkVisual *visual; /* show the primary device time remaining */ device = gpm_engine_get_primary_device (icon->priv->engine); @@ -380,13 +384,12 @@ gpm_tray_icon_create_menu (GpmTrayIcon *icon) gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); /*Set up custom panel menu theme support-gtk3 only */ - GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menu)); + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menu)); /* Fix any failures of compiz/other wm's to communicate with gtk for transparency in menu theme */ - GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel)); - GdkVisual *visual = gdk_screen_get_rgba_visual(screen); + screen = gtk_widget_get_screen(GTK_WIDGET(toplevel)); + visual = gdk_screen_get_rgba_visual(screen); gtk_widget_set_visual(GTK_WIDGET(toplevel), visual); /* Set menu and its toplevel window to follow panel theme */ - GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET(toplevel)); gtk_style_context_add_class(context,"gnome-panel-menu-bar"); gtk_style_context_add_class(context,"mate-panel-menu-bar"); diff --git a/src/gpm-upower.c b/src/gpm-upower.c index 7311936..995f921 100644 --- a/src/gpm-upower.c +++ b/src/gpm-upower.c @@ -534,7 +534,7 @@ gpm_device_kind_to_localised_string (UpDeviceKind kind, guint number) text = ngettext ("Gaming input", "Gaming inputs", number); break; default: - g_warning ("enum unrecognised: %i", kind); + g_warning ("enum unrecognised: %u", kind); text = up_device_kind_to_string (kind); } return text; @@ -582,7 +582,7 @@ gpm_device_kind_to_icon (UpDeviceKind kind) icon = "computer-apple-ipad"; break; default: - g_warning ("enum unrecognised: %i", kind); + g_warning ("enum unrecognised: %u", kind); icon = "gtk-help"; } return icon; diff --git a/src/msd-osd-window.c b/src/msd-osd-window.c index 1b64ec0..e6ebc0b 100644 --- a/src/msd-osd-window.c +++ b/src/msd-osd-window.c @@ -356,7 +356,9 @@ msd_osd_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { - GObject *object; + GObject *object; + GtkWidget *widget; + GtkStyleContext *style_context; object = G_OBJECT_CLASS (msd_osd_window_parent_class)->constructor (type, n_construct_properties, construct_params); @@ -368,8 +370,8 @@ msd_osd_window_constructor (GType type, "focus-on-map", FALSE, NULL); - GtkWidget *widget = GTK_WIDGET (object); - GtkStyleContext *style_context = gtk_widget_get_style_context (widget); + widget = GTK_WIDGET (object); + style_context = gtk_widget_get_style_context (widget); gtk_style_context_add_class (style_context, "osd"); return object; @@ -435,7 +437,8 @@ msd_osd_window_is_valid (MsdOsdWindow *window) static void msd_osd_window_init (MsdOsdWindow *window) { - GdkScreen *screen; + GdkScreen *screen; + GtkStyleContext *style; window->priv = msd_osd_window_get_instance_private (window); @@ -451,7 +454,7 @@ msd_osd_window_init (MsdOsdWindow *window) gtk_window_set_decorated (GTK_WINDOW (window), FALSE); gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE); - GtkStyleContext *style = gtk_widget_get_style_context (GTK_WIDGET (window)); + style = gtk_widget_get_style_context (GTK_WIDGET (window)); gtk_style_context_add_class (style, "window-frame"); /* assume 110x110 on a 640x480 display and scale from there */ -- cgit v1.2.1