diff options
Diffstat (limited to 'capplets')
23 files changed, 321 insertions, 321 deletions
diff --git a/capplets/about-me/fingerprint-strings.h b/capplets/about-me/fingerprint-strings.h index 20446a0b..fa7211d6 100644 --- a/capplets/about-me/fingerprint-strings.h +++ b/capplets/about-me/fingerprint-strings.h @@ -1,7 +1,7 @@ /* * Helper functions to translate statuses and actions to strings * Copyright (C) 2008 Bastien Nocera <[email protected]> - * + * * Experimental code. This will be moved out of fprintd into it's own * package once the system has matured. * @@ -9,12 +9,12 @@ * 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., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. diff --git a/capplets/appearance/appearance-font.c b/capplets/appearance/appearance-font.c index f4dd0d4d..32ba202c 100644 --- a/capplets/appearance/appearance-font.c +++ b/capplets/appearance/appearance-font.c @@ -98,7 +98,7 @@ static void set_fontoptions(PangoContext *context, Antialiasing antialiasing, Hi cairo_font_options_t *opt; cairo_antialias_t aa; cairo_hint_style_t hs; - + switch (antialiasing) { case ANTIALIAS_NONE: aa = CAIRO_ANTIALIAS_NONE; diff --git a/capplets/appearance/appearance-style.c b/capplets/appearance/appearance-style.c index d036c467..cfe35941 100644 --- a/capplets/appearance/appearance-style.c +++ b/capplets/appearance/appearance-style.c @@ -949,12 +949,12 @@ prepare_list (AppearanceData *data, GtkWidget *list, ThemeType type, GCallback c conv_data = g_new (ThemeConvData, 1); conv_data->data = data; conv_data->thumbnail = thumbnail; - + /* set useful data for callbacks */ g_object_set_data_full (G_OBJECT (list), THEME_DATA, conv_data, g_free); g_object_set_data (G_OBJECT (list), GSETTINGS_SETTINGS, settings); g_object_set_data_full (G_OBJECT (list), GSETTINGS_KEY, g_strdup(key), g_free); - + /* select in treeview the theme set in gsettings */ GtkTreeModel *treemodel; treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (list)); @@ -971,7 +971,7 @@ prepare_list (AppearanceData *data, GtkWidget *list, ThemeType type, GCallback c } if (theme) g_free (theme); - + /* connect to gsettings change event */ gchar *signal_name = g_strdup_printf("changed::%s", key); g_signal_connect (settings, signal_name, diff --git a/capplets/common/activate-settings-daemon.c b/capplets/common/activate-settings-daemon.c index f82f0353..21fd2b2b 100644 --- a/capplets/common/activate-settings-daemon.c +++ b/capplets/common/activate-settings-daemon.c @@ -23,7 +23,7 @@ static void popup_error_message (void) } /* Returns FALSE if activation failed, else TRUE */ -gboolean +gboolean activate_settings_daemon (void) { DBusGConnection *connection = NULL; @@ -37,7 +37,7 @@ activate_settings_daemon (void) g_error_free (error); return FALSE; } - + proxy = dbus_g_proxy_new_for_name (connection, "org.mate.SettingsDaemon", "/org/mate/SettingsDaemon", diff --git a/capplets/common/gtkrc-utils.c b/capplets/common/gtkrc-utils.c index b3f0c785..011c8a11 100644 --- a/capplets/common/gtkrc-utils.c +++ b/capplets/common/gtkrc-utils.c @@ -46,11 +46,11 @@ gchar* gtkrc_find_named(const gchar* name) /* First look in the users home directory */ home_dir = g_get_home_dir(); - + if (home_dir) { path = g_build_filename(home_dir, ".themes", name, subpath, NULL); - + if (!g_file_test (path, G_FILE_TEST_EXISTS)) { g_free (path); @@ -91,7 +91,7 @@ void gtkrc_get_details(gchar* filename, GSList** engines, GSList** symbolic_colo } files = g_slist_prepend (files, g_strdup (filename)); - + while (files != NULL) { filename = files->data; diff --git a/capplets/common/mate-theme-apply.c b/capplets/common/mate-theme-apply.c index 6f0cc09e..f1de6bd9 100644 --- a/capplets/common/mate-theme-apply.c +++ b/capplets/common/mate-theme-apply.c @@ -58,7 +58,7 @@ mate_meta_theme_set (MateThemeMetaInfo *meta_theme_info) interface_settings = g_settings_new (INTERFACE_SCHEMA); marco_settings = g_settings_new (MARCO_SCHEMA); mouse_settings = g_settings_new (MOUSE_SCHEMA); - + if (mate_gsettings_schema_exists (NOTIFICATION_SCHEMA)) { notification_settings = g_settings_new (NOTIFICATION_SCHEMA); diff --git a/capplets/default-applications/mate-da-capplet.c b/capplets/default-applications/mate-da-capplet.c index 386765b2..11a57809 100644 --- a/capplets/default-applications/mate-da-capplet.c +++ b/capplets/default-applications/mate-da-capplet.c @@ -73,7 +73,7 @@ set_changed(GtkComboBox* combo, MateDACapplet* capplet, GList* list, gint type) if (index < g_list_length(list)) { item = (GAppInfo*) g_list_nth_data(list, index); - + switch (type) { case DA_TYPE_WEB_BROWSER: @@ -89,11 +89,11 @@ set_changed(GtkComboBox* combo, MateDACapplet* capplet, GList* list, gint type) g_app_info_set_as_default_for_type(item, "application/x-extension-eml", NULL); g_app_info_set_as_default_for_type(item, "message/rfc822", NULL); break; - + case DA_TYPE_FILE: g_app_info_set_as_default_for_type(item, "inode/directory", NULL); break; - + case DA_TYPE_TEXT: g_app_info_set_as_default_for_type(item, "text/plain", NULL); break; @@ -105,7 +105,7 @@ set_changed(GtkComboBox* combo, MateDACapplet* capplet, GList* list, gint type) g_app_info_set_as_default_for_type(item, "audio/x-vorbis+ogg", NULL); g_app_info_set_as_default_for_type(item, "audio/x-wav", NULL); break; - + case DA_TYPE_VIDEO: g_app_info_set_as_default_for_type(item, "video/mp4", NULL); g_app_info_set_as_default_for_type(item, "video/mpeg", NULL); @@ -311,7 +311,7 @@ refresh_combo_box_icons(GtkIconTheme* theme, GtkComboBox* combo_box, GList* app_ return; valid = gtk_tree_model_get_iter_first(model, &iter); - + while (valid) { gtk_tree_model_get(model, &iter, @@ -329,7 +329,7 @@ refresh_combo_box_icons(GtkIconTheme* theme, GtkComboBox* combo_box, GList* app_ { g_object_unref(pixbuf); } - + g_free(icon_name); valid = gtk_tree_model_iter_next(model, &iter); @@ -372,7 +372,7 @@ theme_changed_cb(GtkIconTheme* theme, MateDACapplet* capplet) GdkPixbuf* pixbuf = gtk_icon_info_load_icon(icon_info, NULL); gtk_image_set_from_pixbuf(GTK_IMAGE(icon), pixbuf); - + if (pixbuf) { g_object_unref(pixbuf); @@ -532,7 +532,7 @@ fill_combo_box(GtkIconTheme* theme, GtkComboBox* combo_box, GList* app_list, gch for (entry = app_list; entry != NULL; entry = g_list_next(entry)) { GAppInfo* item = (GAppInfo*) entry->data; - + /* Icon */ GIcon* icon = g_app_info_get_icon(item); gchar* icon_name; @@ -546,7 +546,7 @@ fill_combo_box(GtkIconTheme* theme, GtkComboBox* combo_box, GList* app_list, gch } else { icon_name = g_strdup ("binary"); } - + GtkIconInfo* icon_info = gtk_icon_theme_lookup_icon (theme, icon_name, 22, GTK_ICON_LOOKUP_FORCE_SIZE); pixbuf = gtk_icon_info_load_icon(icon_info, NULL); @@ -562,15 +562,15 @@ fill_combo_box(GtkIconTheme* theme, GtkComboBox* combo_box, GList* app_list, gch { g_object_unref(pixbuf); } - + /* Set the index for the default app */ if (default_app != NULL && g_app_info_equal(item, default_app)) { gtk_combo_box_set_active(combo_box, index); } - + g_free(icon_name); - + index++; } } @@ -786,7 +786,7 @@ show_dialog(MateDACapplet* capplet, const gchar* start_page) nb = GTK_NOTEBOOK(get_widget("preferred_apps_notebook")); pindex = gtk_notebook_page_num(nb, w); - + if (pindex != -1) { gtk_notebook_set_current_page(nb, pindex); diff --git a/capplets/display/scrollarea.c b/capplets/display/scrollarea.c index 89bf6b39..01961443 100644 --- a/capplets/display/scrollarea.c +++ b/capplets/display/scrollarea.c @@ -67,10 +67,10 @@ struct AutoScrollInfo struct FooScrollAreaPrivate { GdkWindow *input_window; - + int width; int height; - + GtkAdjustment *hadj; GtkAdjustment *vadj; @@ -79,16 +79,16 @@ struct FooScrollAreaPrivate int x_offset; int y_offset; - + int min_width; int min_height; GPtrArray *input_regions; - + AutoScrollInfo *auto_scroll_info; - + InputRegion *current_input; - + gboolean grabbed; FooScrollAreaEventFunc grab_func; gpointer grab_data; @@ -144,9 +144,9 @@ static void foo_scroll_area_map (GtkWidget *widget) { FooScrollArea *area = FOO_SCROLL_AREA (widget); - + GTK_WIDGET_CLASS (parent_class)->map (widget); - + if (area->priv->input_window) gdk_window_show (area->priv->input_window); } @@ -155,10 +155,10 @@ static void foo_scroll_area_unmap (GtkWidget *widget) { FooScrollArea *area = FOO_SCROLL_AREA (widget); - + if (area->priv->input_window) gdk_window_hide (area->priv->input_window); - + GTK_WIDGET_CLASS (parent_class)->unmap (widget); } @@ -166,12 +166,12 @@ static void foo_scroll_area_finalize (GObject *object) { FooScrollArea *scroll_area = FOO_SCROLL_AREA (object); - + g_object_unref (scroll_area->priv->hadj); g_object_unref (scroll_area->priv->vadj); - + g_ptr_array_free (scroll_area->priv->input_regions, TRUE); - + g_free (scroll_area->priv); G_OBJECT_CLASS (foo_scroll_area_parent_class)->finalize (object); @@ -234,7 +234,7 @@ foo_scroll_area_class_init (FooScrollAreaClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); - + object_class->finalize = foo_scroll_area_finalize; object_class->set_property = foo_scroll_area_set_property; object_class->get_property = foo_scroll_area_get_property; @@ -271,7 +271,7 @@ foo_scroll_area_class_init (FooScrollAreaClass *class) G_TYPE_NONE, 2, GDK_TYPE_RECTANGLE, GDK_TYPE_RECTANGLE); - + signals[PAINT] = g_signal_new ("paint", G_OBJECT_CLASS_TYPE (object_class), @@ -300,7 +300,7 @@ foo_scroll_area_init (FooScrollArea *scroll_area) gtk_widget_set_has_window (widget, FALSE); gtk_widget_set_redraw_on_allocate (widget, FALSE); - + scroll_area->priv = g_new0 (FooScrollAreaPrivate, 1); scroll_area->priv->width = 0; scroll_area->priv->height = 0; @@ -326,24 +326,24 @@ path_foreach_point (cairo_path_t *path, gpointer user_data) { int i; - + for (i = 0; i < path->num_data; i += path->data[i].header.length) { cairo_path_data_t *data = &(path->data[i]); - + switch (data->header.type) { case CAIRO_PATH_MOVE_TO: case CAIRO_PATH_LINE_TO: func (&(data[1].point.x), &(data[1].point.y), user_data); break; - + case CAIRO_PATH_CURVE_TO: func (&(data[1].point.x), &(data[1].point.y), user_data); func (&(data[2].point.x), &(data[2].point.y), user_data); func (&(data[3].point.x), &(data[3].point.y), user_data); break; - + case CAIRO_PATH_CLOSE_PATH: break; } @@ -413,7 +413,7 @@ clear_exposed_input_region (FooScrollArea *area, allocation_to_canvas (area, &allocation.x, &allocation.y); viewport = cairo_region_create_rectangle (&allocation); cairo_region_subtract (viewport, exposed); - + for (i = 0; i < area->priv->input_regions->len; ++i) { InputRegion *region = area->priv->input_regions->pdata[i]; @@ -511,10 +511,10 @@ foo_scroll_area_get_viewport (FooScrollArea *scroll_area, GdkRectangle *viewport) { g_return_if_fail (FOO_IS_SCROLL_AREA (scroll_area)); - + if (!viewport) return; - + get_viewport (scroll_area, viewport); } @@ -534,7 +534,7 @@ emit_viewport_changed (FooScrollArea *scroll_area, GdkDevice *pointer; int px, py; - g_signal_emit (scroll_area, signals[VIEWPORT_CHANGED], 0, + g_signal_emit (scroll_area, signals[VIEWPORT_CHANGED], 0, new_viewport, old_viewport); if (scroll_area->priv->input_window == NULL) @@ -548,7 +548,7 @@ emit_viewport_changed (FooScrollArea *scroll_area, &px, &py, NULL); - + process_event (scroll_area, FOO_MOTION, px, py); } @@ -570,7 +570,7 @@ set_adjustment_values (FooScrollArea *scroll_area) GtkAdjustment *hadj = scroll_area->priv->hadj; GtkAdjustment *vadj = scroll_area->priv->vadj; - + /* Horizontal */ gtk_widget_get_allocation (GTK_WIDGET (scroll_area), &allocation); g_object_freeze_notify (G_OBJECT (hadj)); @@ -580,7 +580,7 @@ set_adjustment_values (FooScrollArea *scroll_area) gtk_adjustment_set_lower (hadj, 0.0); gtk_adjustment_set_upper (hadj, scroll_area->priv->width); g_object_thaw_notify (G_OBJECT (hadj)); - + /* Vertical */ g_object_freeze_notify (G_OBJECT (vadj)); gtk_adjustment_set_page_size (vadj, allocation.height); @@ -592,7 +592,7 @@ set_adjustment_values (FooScrollArea *scroll_area) clamp_adjustment (hadj); clamp_adjustment (vadj); - + return TRUE; } @@ -608,7 +608,7 @@ foo_scroll_area_realize (GtkWidget *widget) gtk_widget_get_allocation (widget, &widget_allocation); gtk_widget_set_realized (widget, TRUE); - + attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget_allocation.x; attributes.y = widget_allocation.y; @@ -624,13 +624,13 @@ foo_scroll_area_realize (GtkWidget *widget) GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); - + attributes_mask = GDK_WA_X | GDK_WA_Y; window = gtk_widget_get_parent_window (widget); gtk_widget_set_window (widget, window); g_object_ref (window); - + area->priv->input_window = gdk_window_new (window, &attributes, attributes_mask); cr = gdk_cairo_create (gtk_widget_get_window (widget)); @@ -639,7 +639,7 @@ foo_scroll_area_realize (GtkWidget *widget) cairo_destroy (cr); gdk_window_set_user_data (area->priv->input_window, area); - + gtk_widget_style_attach (widget); } @@ -647,14 +647,14 @@ static void foo_scroll_area_unrealize (GtkWidget *widget) { FooScrollArea *area = FOO_SCROLL_AREA (widget); - + if (area->priv->input_window) { gdk_window_set_user_data (area->priv->input_window, NULL); gdk_window_destroy (area->priv->input_window); area->priv->input_window = NULL; } - + GTK_WIDGET_CLASS (parent_class)->unrealize (widget); } @@ -692,7 +692,7 @@ create_new_surface (GtkWidget *widget, return new; } - + static void allocation_to_canvas_region (FooScrollArea *area, cairo_region_t *region) @@ -739,7 +739,7 @@ foo_scroll_area_size_allocate (GtkWidget *widget, cairo_region_destroy (invalid); gtk_widget_set_allocation (widget, allocation); - + if (scroll_area->priv->input_window) { cairo_surface_t *new_surface; @@ -752,9 +752,9 @@ foo_scroll_area_size_allocate (GtkWidget *widget, cairo_surface_destroy (scroll_area->priv->surface); scroll_area->priv->surface = new_surface; } - + get_viewport (scroll_area, &new_viewport); - + emit_viewport_changed (scroll_area, &new_viewport, &old_viewport); } @@ -767,17 +767,17 @@ emit_input (FooScrollArea *scroll_area, gpointer data) { FooScrollAreaEvent event; - + if (!func) return; if (type != FOO_MOTION) emit_input (scroll_area, FOO_MOTION, x, y, func, data); - + event.type = type; event.x = x; event.y = y; - + func (scroll_area, &event, data); } @@ -791,7 +791,7 @@ process_event (FooScrollArea *scroll_area, int i; allocation_to_canvas (scroll_area, &x, &y); - + if (scroll_area->priv->grabbed) { emit_input (scroll_area, input_type, x, y, @@ -825,7 +825,7 @@ process_event (FooScrollArea *scroll_area, inside = cairo_in_fill (cr, x, y); cairo_destroy (cr); - + if (inside) { emit_input (scroll_area, input_type, @@ -834,7 +834,7 @@ process_event (FooScrollArea *scroll_area, path->data); return; } - + path = path->next; } @@ -855,7 +855,7 @@ process_gdk_event (FooScrollArea *scroll_area, GdkEvent *event) { FooScrollAreaEventType input_type; - + if (event->type == GDK_BUTTON_PRESS) input_type = FOO_BUTTON_PRESS; else if (event->type == GDK_BUTTON_RELEASE) @@ -864,7 +864,7 @@ process_gdk_event (FooScrollArea *scroll_area, input_type = FOO_MOTION; else return; - + process_event (scroll_area, input_type, x, y); } @@ -873,9 +873,9 @@ foo_scroll_area_button_press (GtkWidget *widget, GdkEventButton *event) { FooScrollArea *area = FOO_SCROLL_AREA (widget); - + process_gdk_event (area, event->x, event->y, (GdkEvent *)event); - + return TRUE; } @@ -884,9 +884,9 @@ foo_scroll_area_button_release (GtkWidget *widget, GdkEventButton *event) { FooScrollArea *area = FOO_SCROLL_AREA (widget); - + process_gdk_event (area, event->x, event->y, (GdkEvent *)event); - + return FALSE; } @@ -895,7 +895,7 @@ foo_scroll_area_motion (GtkWidget *widget, GdkEventMotion *event) { FooScrollArea *area = FOO_SCROLL_AREA (widget); - + process_gdk_event (area, event->x, event->y, (GdkEvent *)event); return TRUE; } @@ -912,7 +912,7 @@ foo_scroll_area_set_size_fixed_y (FooScrollArea *scroll_area, g_object_thaw_notify (G_OBJECT (scroll_area->priv->vadj)); gtk_adjustment_set_value (scroll_area->priv->vadj, new_y); - + set_adjustment_values (scroll_area); g_object_thaw_notify (G_OBJECT (scroll_area->priv->vadj)); } @@ -923,7 +923,7 @@ foo_scroll_area_set_size (FooScrollArea *scroll_area, int height) { g_return_if_fail (FOO_IS_SCROLL_AREA (scroll_area)); - + /* FIXME: Default scroll algorithm should probably be to * keep the same *area* outside the screen as before. * @@ -935,13 +935,13 @@ foo_scroll_area_set_size (FooScrollArea *scroll_area, * Maybe there should be some generic support for those * widgets. Can that even be done? * - * Should we have a version of this function using + * Should we have a version of this function using * fixed points? */ - + scroll_area->priv->width = width; scroll_area->priv->height = height; - + set_adjustment_values (scroll_area); } @@ -977,7 +977,7 @@ foo_scroll_area_get_preferred_height (GtkWidget *widget, static void foo_scroll_area_scroll (FooScrollArea *area, - gint dx, + gint dx, gint dy) { GdkRectangle allocation; @@ -994,7 +994,7 @@ foo_scroll_area_scroll (FooScrollArea *area, src_area.y -= dy; invalid_region = cairo_region_create_rectangle (&allocation); - + if (gdk_rectangle_intersect (&allocation, &src_area, &move_area)) { cairo_region_t *move_region; @@ -1020,17 +1020,17 @@ foo_scroll_area_scroll (FooScrollArea *area, cairo_destroy (cr); gtk_widget_queue_draw (GTK_WIDGET (area)); - + move_region = cairo_region_create_rectangle (&move_area); cairo_region_translate (move_region, dx, dy); cairo_region_subtract (invalid_region, move_region); cairo_region_destroy (move_region); } - + allocation_to_canvas_region (area, invalid_region); foo_scroll_area_invalidate_region (area, invalid_region); - + cairo_region_destroy (invalid_region); } @@ -1042,9 +1042,9 @@ foo_scrollbar_adjustment_changed (GtkAdjustment *adj, gint dx = 0; gint dy = 0; GdkRectangle old_viewport, new_viewport; - + get_viewport (scroll_area, &old_viewport); - + if (adj == scroll_area->priv->hadj) { /* FIXME: do we treat the offset as int or double, and, @@ -1062,14 +1062,14 @@ foo_scrollbar_adjustment_changed (GtkAdjustment *adj, { g_assert_not_reached (); } - + if (gtk_widget_get_realized (widget)) { foo_scroll_area_scroll (scroll_area, -dx, -dy); } - + get_viewport (scroll_area, &new_viewport); - + emit_viewport_changed (scroll_area, &new_viewport, &old_viewport); } @@ -1079,27 +1079,27 @@ set_one_adjustment (FooScrollArea *scroll_area, GtkAdjustment **location) { g_return_if_fail (location != NULL); - + if (adjustment == *location) return; - + if (!adjustment) adjustment = new_adjustment (); - + g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); - + if (*location) { g_signal_handlers_disconnect_by_func ( *location, foo_scrollbar_adjustment_changed, scroll_area); - + g_object_unref (*location); } - + *location = adjustment; - + g_object_ref_sink (*location); - + g_signal_connect (*location, "value_changed", G_CALLBACK (foo_scrollbar_adjustment_changed), scroll_area); @@ -1136,7 +1136,7 @@ foo_scroll_area_set_min_size (FooScrollArea *scroll_area, { scroll_area->priv->min_width = min_width; scroll_area->priv->min_height = min_height; - + /* FIXME: think through invalidation. * * Goals: - no repainting everything on size_allocate(), @@ -1151,7 +1151,7 @@ user_to_device (double *x, double *y, gpointer data) { cairo_t *cr = data; - + cairo_user_to_device (cr, x, y); } @@ -1228,7 +1228,7 @@ canvas_to_window (FooScrollArea *area, { GtkAllocation allocation; GtkWidget *widget = GTK_WIDGET (area); - + gtk_widget_get_allocation (widget, &allocation); cairo_region_translate (region, -area->priv->x_offset + allocation.x, @@ -1263,10 +1263,10 @@ foo_scroll_area_invalidate_region (FooScrollArea *area, if (gtk_widget_get_realized (widget)) { canvas_to_window (area, region); - + gdk_window_invalidate_region (gtk_widget_get_window (widget), region, TRUE); - + window_to_canvas (area, region); } } @@ -1280,7 +1280,7 @@ foo_scroll_area_invalidate_rect (FooScrollArea *scroll_area, { GdkRectangle rect = { x, y, width, height }; cairo_region_t *region; - + g_return_if_fail (FOO_IS_SCROLL_AREA (scroll_area)); region = cairo_region_create_rectangle (&rect); @@ -1297,11 +1297,11 @@ foo_scroll_area_begin_grab (FooScrollArea *scroll_area, { g_return_if_fail (FOO_IS_SCROLL_AREA (scroll_area)); g_return_if_fail (!scroll_area->priv->grabbed); - + scroll_area->priv->grabbed = TRUE; scroll_area->priv->grab_func = func; scroll_area->priv->grab_data = input_data; - + /* FIXME: we should probably take a server grab */ /* Also, maybe there should be support for setting the grab cursor */ } @@ -1310,7 +1310,7 @@ void foo_scroll_area_end_grab (FooScrollArea *scroll_area) { g_return_if_fail (FOO_IS_SCROLL_AREA (scroll_area)); - + scroll_area->priv->grabbed = FALSE; scroll_area->priv->grab_func = NULL; scroll_area->priv->grab_data = NULL; @@ -1354,7 +1354,7 @@ stop_scrolling (FooScrollArea *area) g_source_remove (area->priv->auto_scroll_info->timeout_id); g_timer_destroy (area->priv->auto_scroll_info->timer); g_free (area->priv->auto_scroll_info); - + area->priv->auto_scroll_info = NULL; } } @@ -1367,14 +1367,14 @@ scroll_idle (gpointer data) AutoScrollInfo *info = area->priv->auto_scroll_info; int new_x, new_y; double elapsed; - + get_viewport (area, &viewport); elapsed = g_timer_elapsed (info->timer, NULL); info->res_x = elapsed * info->dx / 0.2; info->res_y = elapsed * info->dy / 0.2; - + new_x = viewport.x + info->res_x; new_y = viewport.y + info->res_y; @@ -1390,11 +1390,11 @@ scroll_idle (gpointer data) info->res_y < -1.0)) { stop_scrolling (area); - + /* stop scrolling if it didn't have an effect */ return FALSE; } - + return TRUE; } @@ -1410,7 +1410,7 @@ ensure_scrolling (FooScrollArea *area, g_idle_add (scroll_idle, area); area->priv->auto_scroll_info->timer = g_timer_new (); } - + area->priv->auto_scroll_info->dx = dx; area->priv->auto_scroll_info->dy = dy; } @@ -1420,9 +1420,9 @@ foo_scroll_area_auto_scroll (FooScrollArea *scroll_area, FooScrollAreaEvent *event) { GdkRectangle viewport; - + get_viewport (scroll_area, &viewport); - + if (rect_contains (&viewport, event->x, event->y)) { stop_scrolling (scroll_area); @@ -1430,9 +1430,9 @@ foo_scroll_area_auto_scroll (FooScrollArea *scroll_area, else { int dx, dy; - + dx = dy = 0; - + if (event->y < viewport.y) { dy = event->y - viewport.y; @@ -1443,7 +1443,7 @@ foo_scroll_area_auto_scroll (FooScrollArea *scroll_area, dy = event->y - (viewport.y + viewport.height - 1); dy = MAX (dy - 2, 0); } - + if (event->x < viewport.x) { dx = event->x - viewport.x; @@ -1454,7 +1454,7 @@ foo_scroll_area_auto_scroll (FooScrollArea *scroll_area, dx = event->x - (viewport.x + viewport.width - 1); dx = MAX (dx - 2, 0); } - + ensure_scrolling (scroll_area, dx, dy); } } diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index bf498cf6..3dddb784 100644 --- a/capplets/display/xrandr-capplet.c +++ b/capplets/display/xrandr-capplet.c @@ -58,7 +58,7 @@ struct App GtkWidget *panel_checkbox; GtkWidget *clone_checkbox; GtkWidget *show_icon_checkbox; - GtkWidget *primary_button; + GtkWidget *primary_button; /* We store the event timestamp when the Apply button is clicked */ GtkWidget *apply_button; @@ -1628,7 +1628,7 @@ get_display_name (App *app, * translation could be "Pantallas en Espejo", *not* "Espejar Pantallas". */ text = g_strdup_printf (_("Mirror Screens")); - } + } else { text = g_strdup_printf ("<b>%s</b>\n<small>%s</small>", mate_rr_output_info_get_display_name (output), mate_rr_output_info_get_name (output)); } diff --git a/capplets/keybindings/mate-keybinding-properties.c b/capplets/keybindings/mate-keybinding-properties.c index 3a8eefc2..9504af77 100644 --- a/capplets/keybindings/mate-keybinding-properties.c +++ b/capplets/keybindings/mate-keybinding-properties.c @@ -1113,7 +1113,7 @@ static gboolean cb_check_for_uniqueness(GtkTreeModel* model, GtkTreePath* path, { return FALSE; } - + gchar *new_key_schema = NULL; gchar *element_schema = NULL; gchar *new_key_path = NULL; @@ -1124,7 +1124,7 @@ static gboolean cb_check_for_uniqueness(GtkTreeModel* model, GtkTreePath* path, g_object_get (new_key->settings, "schema-id", &new_key_schema, NULL); g_object_get (new_key->settings, "path", &new_key_path, NULL); } - + if (element->settings) { g_object_get (element->settings, "schema-id", &element_schema, NULL); @@ -1656,7 +1656,7 @@ add_custom_shortcut (GtkTreeView *tree_view, } else { - g_free (key_entry->gsettings_path); + g_free (key_entry->gsettings_path); g_free (key_entry->gsettings_key); g_free (key_entry->description); g_free (key_entry->desc_gsettings_key); diff --git a/capplets/keyboard/mate-keyboard-properties-xkblt.c b/capplets/keyboard/mate-keyboard-properties-xkblt.c index 115ffac0..b5ee38e7 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkblt.c +++ b/capplets/keyboard/mate-keyboard-properties-xkblt.c @@ -102,7 +102,7 @@ xkb_layouts_get_selected_list (void) if (retval == NULL) { if (initial_config.layouts_variants != NULL) { for (i = 0; initial_config.layouts_variants[i] != NULL; i++) - retval = + retval = g_slist_prepend (retval, g_strdup (initial_config.layouts_variants[i])); } retval = g_slist_reverse (retval); diff --git a/capplets/keyboard/mate-keyboard-properties-xkbltadd.c b/capplets/keyboard/mate-keyboard-properties-xkbltadd.c index 6b54fff2..8499314a 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkbltadd.c +++ b/capplets/keyboard/mate-keyboard-properties-xkbltadd.c @@ -408,7 +408,7 @@ xkl_layout_chooser_add_default_switcher_if_necessary (GSList * (layouts_list_strv, options_list_strv, &was_appended); if (was_appended) { xkb_options_set_selected_list (options_list); - + } clear_xkb_elements_list (options_list); } diff --git a/capplets/keyboard/mate-keyboard-properties-xkbot.c b/capplets/keyboard/mate-keyboard-properties-xkbot.c index e67fcf86..cc161b62 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkbot.c +++ b/capplets/keyboard/mate-keyboard-properties-xkbot.c @@ -63,7 +63,7 @@ xkb_options_get_selected_list (void) if (retval == NULL) { if (initial_config.options != NULL) { for (i = 0; initial_config.options[i] != NULL; i++) - retval = + retval = g_slist_prepend (retval, g_strdup (initial_config.options[i])); } retval = g_slist_reverse (retval); diff --git a/capplets/mouse/mate-mouse-properties.c b/capplets/mouse/mate-mouse-properties.c index fe8bad31..98efc439 100644 --- a/capplets/mouse/mate-mouse-properties.c +++ b/capplets/mouse/mate-mouse-properties.c @@ -284,7 +284,7 @@ setup_dialog (GtkBuilder *dialog) g_settings_bind (mouse_settings, DOUBLE_CLICK_KEY, gtk_range_get_adjustment (GTK_RANGE (WID ("delay_scale"))), "value", G_SETTINGS_BIND_DEFAULT); - + gtk_image_set_from_stock (GTK_IMAGE (WID ("double_click_image")), MOUSE_DBLCLCK_OFF, mouse_capplet_dblclck_icon_get_size ()); g_object_set_data (G_OBJECT (WID ("double_click_eventbox")), "image", WID ("double_click_image")); g_signal_connect (WID ("double_click_eventbox"), "button_press_event", @@ -339,10 +339,10 @@ setup_dialog (GtkBuilder *dialog) gtk_box_pack_start (GTK_BOX (WID ("hbox_three_finger_click")), three_click_comboxbox, FALSE, FALSE, 6); int i; for (i=0; i<4; i++) { - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (two_click_comboxbox), emulation_values[i]); - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (three_click_comboxbox), emulation_values[i]); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (two_click_comboxbox), emulation_values[i]); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (three_click_comboxbox), emulation_values[i]); } - + g_signal_connect (two_click_comboxbox, "changed", G_CALLBACK (comboxbox_two_finger_changed_callback), dialog); g_signal_connect (three_click_comboxbox, "changed", G_CALLBACK (comboxbox_three_finger_changed_callback), dialog); gtk_combo_box_set_active (GTK_COMBO_BOX (two_click_comboxbox), g_settings_get_int (touchpad_settings, "two-finger-click")); diff --git a/capplets/time-admin/src/main.c b/capplets/time-admin/src/main.c index 96d0df6d..f33864f7 100644 --- a/capplets/time-admin/src/main.c +++ b/capplets/time-admin/src/main.c @@ -1,4 +1,4 @@ -/* mate-user-admin +/* mate-user-admin * Copyright (C) 2018 zhuyaliang https://github.com/zhuyaliang/ * * This program is free software: you can redistribute it and/or modify @@ -30,25 +30,25 @@ static gboolean CheckClockHealth(gpointer data) TimeAdmin *ta = (TimeAdmin *)data; Update_Clock_Start(ta); ta->ApplyId = 0; - + return FALSE; -} +} static void update_apply_timeout(TimeAdmin *ta) { Update_Clock_Stop(ta); - if (ta->ApplyId > 0) + if (ta->ApplyId > 0) { g_source_remove (ta->ApplyId); ta->ApplyId = 0; } ta->ApplyId = g_timeout_add (10000, (GSourceFunc)CheckClockHealth,ta); -} +} static void ChangeTimeValue(GtkSpinButton *spin_button, gpointer *data) { TimeAdmin *ta = (TimeAdmin *)data; if(TimeoutFlag == 0) - { + { update_apply_timeout(ta); } } @@ -62,16 +62,16 @@ static GdkPixbuf * GetAppIcon(void) { MessageReport(("Get Icon Fail"),Error->message,ERROR); g_error_free(Error); - } - + } + return Pixbuf; -} +} static gboolean on_window_quit (GtkWidget *widget, GdkEvent *event, gpointer user_data) { TimeAdmin *ta = (TimeAdmin *)user_data; - + QuitApp(ta); return TRUE; } @@ -80,7 +80,7 @@ static void CloseWindow (GtkButton *button,gpointer data) TimeAdmin *ta = (TimeAdmin *)data; QuitApp(ta); -} +} static void UpdatePermission(TimeAdmin *ta) { gboolean is_authorized; @@ -116,7 +116,7 @@ static void InitMainWindow(TimeAdmin *ta) gtk_window_set_resizable(GTK_WINDOW(Window),FALSE); gtk_window_set_hide_titlebar_when_maximized(GTK_WINDOW(Window),TRUE); gtk_window_set_position(GTK_WINDOW(Window), GTK_WIN_POS_CENTER); - gtk_window_set_title(GTK_WINDOW(Window),_("Time and Date Manager")); + gtk_window_set_title(GTK_WINDOW(Window),_("Time and Date Manager")); gtk_container_set_border_width(GTK_CONTAINER(Window),10); gtk_widget_set_size_request(Window, 300, 360); g_signal_connect(G_OBJECT(Window), @@ -152,39 +152,39 @@ static int RecordPid(void) { int pid = 0; int fd; - int Length = 0; + int Length = 0; char WriteBuf[30] = { 0 }; fd = open(LOCKFILE,O_WRONLY|O_CREAT|O_TRUNC,0777); if(fd < 0) { MessageReport(_("open file"),_("Create pid file failed"),ERROR); - return -1; - } - chmod(LOCKFILE,0777); + return -1; + } + chmod(LOCKFILE,0777); pid = getpid(); sprintf(WriteBuf,"%d",pid); Length = write(fd,WriteBuf,strlen(WriteBuf)); if(Length <= 0 ) { MessageReport(_("write file"),_("write pid file failed"),ERROR); - return -1; - } + return -1; + } close(fd); return 0; -} +} /****************************************************************************** -* Function: ProcessRuning -* -* Explain: Check whether the process has been started,If the process is not started, +* Function: ProcessRuning +* +* Explain: Check whether the process has been started,If the process is not started, * record the current process ID =====>"/tmp/user-admin.pid" -* -* Input: -* -* +* +* Input: +* +* * Output: start :TRUE * not start :FALSE -* +* * Author: zhuyaliang 31/07/2018 ******************************************************************************/ static gboolean ProcessRuning(void) @@ -201,38 +201,38 @@ static gboolean ProcessRuning(void) { MessageReport(_("open file"),_("open pid file failed"),ERROR); return TRUE; - } + } if(read(fd,ReadBuf,sizeof(ReadBuf)) <= 0) { MessageReport(_("read file"),_("read pid file failed"),ERROR); goto ERROREXIT; - } + } pid = atoi(ReadBuf); if(kill(pid,0) == 0) - { + { goto ERROREXIT; } } - + if(RecordPid() < 0) Run = TRUE; - + return Run; ERROREXIT: close(fd); return TRUE; -} +} static char *translate(const char *value) { g_autofree gchar *zone_translated = NULL; char *name; - + zone_translated = g_strdup (dgettext (GETTEXT_PACKAGE_TIMEZONES,value)); name = g_strdup_printf (C_("timezone loc", "%s"),zone_translated); - + return name; -} +} static GtkWidget * TimeZoneAndNtp(TimeAdmin *ta) { GtkWidget *table; @@ -249,8 +249,8 @@ static GtkWidget * TimeZoneAndNtp(TimeAdmin *ta) gtk_widget_set_halign(TimeZoneLabel,GTK_ALIGN_START); SetLableFontType(TimeZoneLabel,11,_("Time Zone:")); gtk_grid_attach(GTK_GRID(table) ,TimeZoneLabel, 0 , 0 , 1 , 1); - - SetupTimezoneDialog(ta); + + SetupTimezoneDialog(ta); TimeZone = GetTimeZone(ta); ZoneName = translate(TimeZone); ta->TimeZoneButton = gtk_button_new_with_label(ZoneName); @@ -260,12 +260,12 @@ static GtkWidget * TimeZoneAndNtp(TimeAdmin *ta) ta); gtk_grid_attach(GTK_GRID(table) ,ta->TimeZoneButton,1 , 0 , 3 , 1); - + NtpSyncLabel = gtk_label_new(NULL); gtk_widget_set_halign(NtpSyncLabel,GTK_ALIGN_START); SetLableFontType(NtpSyncLabel,11,_("Ntp Sync:")); gtk_grid_attach(GTK_GRID(table) ,NtpSyncLabel, 0 , 1 , 1 , 1); - + ta->NtpSyncSwitch = gtk_switch_new(); NtpState = GetNtpState(ta); ta->NtpState = NtpState; @@ -276,13 +276,13 @@ static GtkWidget * TimeZoneAndNtp(TimeAdmin *ta) "state-set", G_CALLBACK (ChangeNtpSync), ta); - + gtk_grid_set_row_spacing(GTK_GRID(table), 6); gtk_grid_set_column_spacing(GTK_GRID(table), 12); return table; -} +} static GtkWidget *GetSpinButton(int Initial,int Maximum,TimeAdmin *ta) { @@ -301,45 +301,45 @@ static GtkWidget *GetSpinButton(int Initial,int Maximum,TimeAdmin *ta) G_CALLBACK (ChangeTimeValue), ta); - SetTooltip(SpinButton,!ta->NtpState); + SetTooltip(SpinButton,!ta->NtpState); return SpinButton; -} +} static GtkWidget *SetClock(TimeAdmin *ta) { GtkWidget *table; GtkWidget *TimeLabel; struct tm *LocalTime; - + table = gtk_grid_new(); gtk_grid_set_column_homogeneous(GTK_GRID(table),TRUE); - + TimeLabel = gtk_label_new(NULL); SetLableFontType(TimeLabel,13,_("Set Time")); gtk_widget_set_halign(TimeLabel,GTK_ALIGN_CENTER); gtk_widget_set_valign(TimeLabel,GTK_ALIGN_START); gtk_widget_set_hexpand(TimeLabel,FALSE); gtk_grid_attach(GTK_GRID(table) ,TimeLabel, 1 , 0 , 1 , 1); - + LocalTime = GetCurrentTime(); ta->UpdateTimeId = 0; ta->ApplyId = 0; - + ta->HourSpin = GetSpinButton(LocalTime->tm_hour,23,ta); gtk_grid_attach(GTK_GRID(table) ,ta->HourSpin, 0 , 1 , 1 , 1); - + ta->MinuteSpin = GetSpinButton(LocalTime->tm_min,59,ta); gtk_grid_attach(GTK_GRID(table) ,ta->MinuteSpin, 1 , 1 , 1 , 1); ta->SecondSpin = GetSpinButton (LocalTime->tm_sec,59,ta); gtk_grid_attach(GTK_GRID(table) ,ta->SecondSpin, 2 , 1 , 1 , 1); - + Update_Clock_Start(ta); - + gtk_grid_set_row_spacing(GTK_GRID(table), 6); gtk_grid_set_column_spacing(GTK_GRID(table), 12); - + return table; -} +} static GtkWidget *SetDate(TimeAdmin *ta) { @@ -349,15 +349,15 @@ static GtkWidget *SetDate(TimeAdmin *ta) table = gtk_grid_new(); gtk_grid_set_column_homogeneous(GTK_GRID(table),TRUE); - + DateLabel = gtk_label_new(NULL); SetLableFontType(DateLabel,13,_("Set Date")); gtk_grid_attach(GTK_GRID(table) ,DateLabel, 1 , 0 , 2 , 2); - + LocalTime = GetCurrentTime(); ta->Calendar = gtk_calendar_new (); gtk_widget_set_sensitive(ta->Calendar,!ta->NtpState); - SetTooltip(ta->Calendar,!ta->NtpState); + SetTooltip(ta->Calendar,!ta->NtpState); gtk_calendar_mark_day(GTK_CALENDAR(ta->Calendar),LocalTime->tm_mday); ta->OldDay = LocalTime->tm_mday; gtk_grid_attach(GTK_GRID(table) ,ta->Calendar, 0 , 2 , 4 , 3); @@ -368,9 +368,9 @@ static GtkWidget *SetDate(TimeAdmin *ta) "clicked", G_CALLBACK (CloseWindow), ta); - + gtk_grid_attach(GTK_GRID(table) ,ta->ButtonLock, 0 , 5 , 1 , 1); - + ta->SaveButton = gtk_button_new_with_label (_("Save")); gtk_widget_set_sensitive(ta->SaveButton,!ta->NtpState); gtk_grid_attach(GTK_GRID(table) ,ta->SaveButton, 2 , 5 , 1 , 1); @@ -381,7 +381,7 @@ static GtkWidget *SetDate(TimeAdmin *ta) gtk_grid_set_row_spacing(GTK_GRID(table), 6); gtk_grid_set_column_spacing(GTK_GRID(table), 12); - + return table; } @@ -394,7 +394,7 @@ static void CreateClockInterface(TimeAdmin *ta) Vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); gtk_container_add(GTK_CONTAINER(ta->MainWindow), Vbox); - + Vbox1 = TimeZoneAndNtp(ta); gtk_box_pack_start(GTK_BOX(Vbox),Vbox1,TRUE,TRUE,8); @@ -402,7 +402,7 @@ static void CreateClockInterface(TimeAdmin *ta) gtk_box_pack_start(GTK_BOX(Vbox),Vbox2,TRUE,TRUE,8); Vbox3 = SetDate(ta); gtk_box_pack_start(GTK_BOX(Vbox),Vbox3,TRUE,TRUE,8); -} +} static gboolean InitDbusProxy(TimeAdmin *ta) { GError *error = NULL; @@ -412,7 +412,7 @@ static gboolean InitDbusProxy(TimeAdmin *ta) { MessageReport(_("g_bus_get_sync"),error->message,ERROR); goto EXIT; - } + } ta->proxy = g_dbus_proxy_new_sync (ta->Connection, G_DBUS_PROXY_FLAGS_NONE, NULL, @@ -425,29 +425,29 @@ static gboolean InitDbusProxy(TimeAdmin *ta) { MessageReport(_("g_bus_proxy_new"),error->message,ERROR); goto EXIT; - } + } return TRUE; EXIT: g_error_free(error); return FALSE; -} +} int main(int argc, char **argv) { TimeAdmin ta; - bindtextdomain (PACKAGE,MATELOCALEDIR); - textdomain (PACKAGE); - bind_textdomain_codeset (GETTEXT_PACKAGE_TIMEZONES, "UTF-8"); - + bindtextdomain (PACKAGE,MATELOCALEDIR); + textdomain (PACKAGE); + bind_textdomain_codeset (GETTEXT_PACKAGE_TIMEZONES, "UTF-8"); + gtk_init(&argc, &argv); - + /* Create the main window */ InitMainWindow(&ta); /* Check whether the process has been started */ if(ProcessRuning() == TRUE) - exit(0); + exit(0); if(InitDbusProxy(&ta) == FALSE) { exit(0); @@ -456,6 +456,6 @@ int main(int argc, char **argv) UpdatePermission(&ta); gtk_widget_show_all(ta.MainWindow); gtk_main(); - + return TRUE; } diff --git a/capplets/time-admin/src/time-map.c b/capplets/time-admin/src/time-map.c index 10a3666e..ad38ef52 100644 --- a/capplets/time-admin/src/time-map.c +++ b/capplets/time-admin/src/time-map.c @@ -1,4 +1,4 @@ -/* time-admin +/* time-admin * Copyright (C) 2018 zhuyaliang https://github.com/zhuyaliang/ * * This program is free software: you can redistribute it and/or modify @@ -31,13 +31,13 @@ typedef struct guchar green; guchar blue; guchar alpha; -}TimezoneMapOffset; +}TimezoneMapOffset; enum { LOCATION_CHANGED, LAST_SIGNAL }; - + G_DEFINE_TYPE (TimezoneMap, timezone_map, GTK_TYPE_WIDGET) static guint signals[LAST_SIGNAL]; static TimezoneMapOffset color_codes[] = @@ -428,13 +428,13 @@ set_location (TimezoneMap *map, TzLocation *location) { g_autoptr(TzInfo) info = NULL; - + map->location = location; info = tz_info_from_location (map->location); map->selected_offset = tz_location_get_utc_offset (map->location) - / (60.0*60.0) + + / (60.0*60.0) + ((info->daylight) ? -1.0 : 0.0); - + g_signal_emit (map, signals[LOCATION_CHANGED], 0, map->location,NULL); } @@ -524,8 +524,8 @@ timezone_map_class_init (TimezoneMapClass *klass) widget_class->realize = cc_timezone_map_realize; widget_class->draw = cc_timezone_map_draw; widget_class->state_flags_changed = cc_timezone_map_state_flags_changed; - - + + signals[LOCATION_CHANGED] = g_signal_new ("location-changed", TYPE_TIMEZONE_MAP, G_SIGNAL_RUN_FIRST, @@ -541,10 +541,10 @@ static void timezone_map_init (TimezoneMap *map) { GError *err = NULL; - + map->orig_background = gdk_pixbuf_new_from_file (TIMPZONEDIR"bg.png",&err); if (!map->orig_background) - { + { g_warning ("Could not load background image: %s", (err) ? err->message : "Unknown error"); g_clear_error (&err); @@ -575,10 +575,10 @@ timezone_map_init (TimezoneMap *map) map->tzdb = tz_load_db (); - g_signal_connect_object (map, - "button-press-event", - G_CALLBACK (button_press_event), - map, + g_signal_connect_object (map, + "button-press-event", + G_CALLBACK (button_press_event), + map, G_CONNECT_SWAPPED); } gboolean timezone_map_set_timezone (TimezoneMap *map, @@ -588,7 +588,7 @@ gboolean timezone_map_set_timezone (TimezoneMap *map, guint i; g_autofree gchar *real_tz = NULL; gboolean ret; - + real_tz = tz_info_get_clean_name (map->tzdb, timezone); locations = tz_get_locations (map->tzdb); @@ -612,7 +612,7 @@ gboolean timezone_map_set_timezone (TimezoneMap *map, return ret; } TzLocation *timezone_map_get_location (TimezoneMap *map) -{ +{ return map->location; } void timezone_map_set_bubble_text (TimezoneMap *map, @@ -624,6 +624,6 @@ void timezone_map_set_bubble_text (TimezoneMap *map, } TimezoneMap * timezone_map_new (void) -{ +{ return g_object_new (TYPE_TIMEZONE_MAP, NULL); -} +} diff --git a/capplets/time-admin/src/time-map.h b/capplets/time-admin/src/time-map.h index e7e574dc..979dceaf 100644 --- a/capplets/time-admin/src/time-map.h +++ b/capplets/time-admin/src/time-map.h @@ -1,4 +1,4 @@ -/* time-admin +/* time-admin * Copyright (C) 2018 zhuyaliang https://github.com/zhuyaliang/ * * This program is free software: you can redistribute it and/or modify @@ -49,7 +49,7 @@ typedef struct TimezoneMap typedef struct TimezoneMapClass { GtkWidgetClass parent_class; - + } TimezoneMapClass; GType timezone_map_get_type (void) G_GNUC_CONST; @@ -62,7 +62,7 @@ gboolean timezone_map_set_timezone (TimezoneMap *map, TzLocation *timezone_map_get_location (TimezoneMap *map); -TimezoneMap * timezone_map_new (void); +TimezoneMap * timezone_map_new (void); G_END_DECLS #endif diff --git a/capplets/time-admin/src/time-share.c b/capplets/time-admin/src/time-share.c index b4c34e80..797f506f 100644 --- a/capplets/time-admin/src/time-share.c +++ b/capplets/time-admin/src/time-share.c @@ -1,4 +1,4 @@ -/* time-admin +/* time-admin * Copyright (C) 2018 zhuyaliang https://github.com/zhuyaliang/ * * This program is free software: you can redistribute it and/or modify @@ -22,14 +22,14 @@ /****************************************************************************** * Function: MessageReport -* +* * Explain: Prompt information dialog -* +* * Input: @Title Message title -* @Msg Message content +* @Msg Message content * @nType Message type -* Output: -* +* Output: +* * Author: zhuyaliang 25/05/2018 ******************************************************************************/ int MessageReport(const char *Title,const char *Msg,int nType) @@ -85,7 +85,7 @@ int MessageReport(const char *Title,const char *Msg,int nType) GTK_BUTTONS_YES_NO, "%s",Title); break; - } + } default : break; @@ -114,12 +114,12 @@ void QuitApp(TimeAdmin *ta) if(ta->UpdateTimeId > 0) { g_source_remove (ta->UpdateTimeId); - } + } if(ta->ApplyId > 0) { g_source_remove(ta->ApplyId); - } - + } + gtk_main_quit(); } GtkWidget* DialogAddButtonWithIconName (GtkDialog *dialog, diff --git a/capplets/time-admin/src/time-share.h b/capplets/time-admin/src/time-share.h index a0088a87..e5e8a476 100644 --- a/capplets/time-admin/src/time-share.h +++ b/capplets/time-admin/src/time-share.h @@ -1,4 +1,4 @@ -/* time-admin +/* time-admin * Copyright (C) 2018 zhuyaliang https://github.com/zhuyaliang/ * * This program is free software: you can redistribute it and/or modify @@ -46,7 +46,7 @@ GtkWidget *WindowLogin; int TimeoutFlag; -typedef struct +typedef struct { GtkWidget *MainWindow; GtkWidget *HourSpin; @@ -57,7 +57,7 @@ typedef struct GtkWidget *Calendar; GtkWidget *CloseButton; GtkWidget *SaveButton; - int UpdateTimeId; + int UpdateTimeId; int ApplyId; int OldDay; gboolean NtpState; diff --git a/capplets/time-admin/src/time-tool.c b/capplets/time-admin/src/time-tool.c index f2375808..0e12bd65 100644 --- a/capplets/time-admin/src/time-tool.c +++ b/capplets/time-admin/src/time-tool.c @@ -1,4 +1,4 @@ -/* time-admin +/* time-admin * Copyright (C) 2018 zhuyaliang https://github.com/zhuyaliang/ * * This program is free software: you can redistribute it and/or modify @@ -25,20 +25,20 @@ struct tm *GetCurrentTime(void) time_t tt; tzset(); tt=time(NULL); - + return localtime(&tt); } static void UpdateDate(TimeAdmin *ta,gboolean state) { struct tm *LocalTime; - + if(state == TRUE) - { + { LocalTime = GetCurrentTime(); - gtk_calendar_select_month (GTK_CALENDAR (ta->Calendar), + gtk_calendar_select_month (GTK_CALENDAR (ta->Calendar), LocalTime->tm_mon, LocalTime->tm_year+1900); - gtk_calendar_select_day (GTK_CALENDAR (ta->Calendar), + gtk_calendar_select_day (GTK_CALENDAR (ta->Calendar), LocalTime->tm_mday); } } @@ -47,18 +47,18 @@ static gboolean UpdateClock(gpointer data) TimeAdmin *ta = (TimeAdmin *)data; struct tm *LocalTime; gchar *str; - + LocalTime = GetCurrentTime(); TimeoutFlag = 1; gtk_spin_button_set_value(GTK_SPIN_BUTTON(ta->HourSpin),LocalTime->tm_hour); gtk_spin_button_set_value(GTK_SPIN_BUTTON(ta->MinuteSpin),LocalTime->tm_min); str = g_strdup_printf ("%02d", LocalTime->tm_sec); gtk_entry_set_text(GTK_ENTRY(ta->SecondSpin),str); - - UpdateDate(ta,ta->NtpState); + + UpdateDate(ta,ta->NtpState); gtk_calendar_mark_day(GTK_CALENDAR(ta->Calendar),LocalTime->tm_mday); if(LocalTime->tm_mday != ta->OldDay) - { + { gtk_calendar_unmark_day(GTK_CALENDAR(ta->Calendar),ta->OldDay); ta->OldDay = LocalTime->tm_mday; } @@ -72,16 +72,16 @@ void Update_Clock_Start(TimeAdmin *ta) if(ta->UpdateTimeId <= 0) { ta->UpdateTimeId = g_timeout_add(1000,(GSourceFunc)UpdateClock,ta); - } + } -} +} void Update_Clock_Stop(TimeAdmin *ta) { if(ta->UpdateTimeId > 0) { g_source_remove(ta->UpdateTimeId); ta->UpdateTimeId = 0; - } + } } gboolean GetNtpState(TimeAdmin *ta) { @@ -102,7 +102,7 @@ gboolean GetNtpState(TimeAdmin *ta) { goto EXIT; } - + ret = g_dbus_proxy_call_sync (proxy, "Get", g_variant_new ("(ss)", @@ -124,7 +124,7 @@ EXIT: g_error_free(error); return FALSE; -} +} const gchar *GetTimeZone(TimeAdmin *ta) { @@ -145,7 +145,7 @@ const gchar *GetTimeZone(TimeAdmin *ta) { goto EXIT; } - + ret = g_dbus_proxy_call_sync (proxy, "Get", g_variant_new ("(ss)", @@ -172,7 +172,7 @@ void SetTimeZone(GDBusProxy *proxy,const char *zone) { GError *error = NULL; GVariant *ret; - + ret = g_dbus_proxy_call_sync (proxy, "SetTimezone", g_variant_new ("(sb)",zone,1), @@ -184,20 +184,20 @@ void SetTimeZone(GDBusProxy *proxy,const char *zone) if(ret == NULL) { MessageReport(_("Set time zone"),error->message,ERROR); - } -} + } +} static void ChangeSpinBttonState(TimeAdmin *ta,gboolean State) { gtk_widget_set_sensitive(ta->SaveButton,!State); - SetTooltip(ta->SaveButton,!ta->NtpState); + SetTooltip(ta->SaveButton,!ta->NtpState); gtk_widget_set_sensitive(ta->HourSpin, !State); - SetTooltip(ta->HourSpin,!ta->NtpState); + SetTooltip(ta->HourSpin,!ta->NtpState); gtk_widget_set_sensitive(ta->MinuteSpin,!State); - SetTooltip(ta->MinuteSpin,!ta->NtpState); + SetTooltip(ta->MinuteSpin,!ta->NtpState); gtk_widget_set_sensitive(ta->SecondSpin,!State); - SetTooltip(ta->SecondSpin,!ta->NtpState); + SetTooltip(ta->SecondSpin,!ta->NtpState); gtk_widget_set_sensitive(ta->Calendar, !State); - SetTooltip(ta->Calendar,!ta->NtpState); + SetTooltip(ta->Calendar,!ta->NtpState); } gboolean ChangeNtpSync(GtkSwitch *widget,gboolean state,gpointer data) @@ -205,7 +205,7 @@ gboolean ChangeNtpSync(GtkSwitch *widget,gboolean state,gpointer data) TimeAdmin *ta = (TimeAdmin *)data; GError *error = NULL; GVariant *ret; - + ret = g_dbus_proxy_call_sync (ta->proxy, "SetNTP", g_variant_new ("(bb)",state,state), @@ -219,22 +219,22 @@ gboolean ChangeNtpSync(GtkSwitch *widget,gboolean state,gpointer data) MessageReport(_("Set Ntp sync"),error->message,ERROR); g_error_free(error); return TRUE; - } + } else { ta->NtpState = state; ChangeSpinBttonState(ta,state); Update_Clock_Start(ta); UpdateDate(ta,state); - } + } return FALSE; -} +} static guint GetTimeStamp(TimeAdmin *ta) { guint year,month,day,hour,min,sec; GDateTime *dt; char *st; - + gtk_calendar_get_date(GTK_CALENDAR(ta->Calendar),&year,&month,&day); hour = gtk_spin_button_get_value(GTK_SPIN_BUTTON(ta->HourSpin)); min = gtk_spin_button_get_value(GTK_SPIN_BUTTON(ta->MinuteSpin)); @@ -249,7 +249,7 @@ static void SetTime(GDBusProxy *proxy,gint64 TimeSec) { GError *error = NULL; GVariant *ret; - + ret = g_dbus_proxy_call_sync (proxy, "SetTime", g_variant_new ("(xbb)",TimeSec * 1000 * 1000,0,0), @@ -262,8 +262,8 @@ static void SetTime(GDBusProxy *proxy,gint64 TimeSec) { MessageReport(_("Set Ntp sync"),error->message,ERROR); g_error_free(error); - } -} + } +} void SaveModifyTime (GtkButton *button,gpointer data) { TimeAdmin *ta = (TimeAdmin *)data; @@ -277,5 +277,5 @@ void SaveModifyTime (GtkButton *button,gpointer data) else { MessageReport(_("Set Time"),_("NTP synchronization has been started, the modification is invalid"),INFOR); - } -} + } +} diff --git a/capplets/time-admin/src/time-tool.h b/capplets/time-admin/src/time-tool.h index ad098bce..f5461b0d 100644 --- a/capplets/time-admin/src/time-tool.h +++ b/capplets/time-admin/src/time-tool.h @@ -1,4 +1,4 @@ -/* time-admin +/* time-admin * Copyright (C) 2018 zhuyaliang https://github.com/zhuyaliang/ * * This program is free software: you can redistribute it and/or modify diff --git a/capplets/time-admin/src/time-zone.c b/capplets/time-admin/src/time-zone.c index b2c6265c..a0852bf2 100644 --- a/capplets/time-admin/src/time-zone.c +++ b/capplets/time-admin/src/time-zone.c @@ -1,4 +1,4 @@ -/* time-admin +/* time-admin * Copyright (C) 2018 zhuyaliang https://github.com/zhuyaliang/ * * This program is free software: you can redistribute it and/or modify @@ -94,8 +94,8 @@ static void load_backward_tz (TzDB *tz_db) { g_error("%s does not exist\r\n",BACKFILE); - } - while(fgets(buf,128,fp)) + } + while(fgets(buf,128,fp)) { g_auto(GStrv) items = NULL; guint j; @@ -128,26 +128,26 @@ static void load_backward_tz (TzDB *tz_db) real = "Etc/GMT"; g_hash_table_insert (tz_db->backward, g_strdup (alias), g_strdup (real)); - - } + + } fclose(fp); } TzDB *tz_load_db (void) -{ +{ g_autofree gchar *tz_data_file = NULL; TzDB *tz_db; FILE *tzfile; char buf[4096]; tz_data_file = tz_data_file_get (); - if (!tz_data_file) + if (!tz_data_file) { g_warning ("Could not get the TimeZone data file name"); return NULL; } tzfile = fopen (tz_data_file, "r"); - if (!tzfile) + if (!tzfile) { g_warning ("Could not open *%s*\n", tz_data_file); return NULL; @@ -224,15 +224,15 @@ static GtkWidget *GetTimeZoneMap(TimeAdmin *ta) "location-changed", G_CALLBACK (LocationChanged), ta); - + completion = gtk_entry_completion_new (); gtk_entry_set_completion (GTK_ENTRY (ta->TimezoneEntry), completion); gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (ta->CityListStore)); gtk_entry_completion_set_text_column (completion, CITY_COL_CITY_HUMAN_READABLE); - + return map; -} +} static char * translated_city_name (TzLocation *loc) { @@ -273,7 +273,7 @@ update_timezone (TimezoneMap *map) current_location = timezone_map_get_location (TIMEZONEMAP (map)); city_country = translated_city_name (current_location); - + timezone = g_time_zone_new (current_location->zone); current_date = g_date_time_new_now_local (); date = g_date_time_to_timezone (current_date, timezone); @@ -323,12 +323,12 @@ static void LoadCities (TzLocation *loc, g_autofree gchar *human_readable = NULL; human_readable = translated_city_name (loc); - gtk_list_store_insert_with_values (CityStore, - NULL, + gtk_list_store_insert_with_values (CityStore, + NULL, 0, - CITY_COL_CITY_HUMAN_READABLE, + CITY_COL_CITY_HUMAN_READABLE, human_readable, - CITY_COL_ZONE, + CITY_COL_ZONE, loc->zone, -1); } @@ -336,13 +336,13 @@ static void LoadCities (TzLocation *loc, static void CreateCityList(TimeAdmin *ta) { g_autoptr(TzDB) db = NULL; - + ta->CityListStore = gtk_list_store_new (CITY_NUM_COLS,G_TYPE_STRING,G_TYPE_STRING); - + db = tz_load_db (); g_ptr_array_foreach (db->locations, (GFunc) LoadCities, ta->CityListStore); -} +} static GtkWidget *CreateZoneFrame(TimeAdmin *ta) { GtkWidget *TimeZoneFrame; @@ -350,9 +350,9 @@ static GtkWidget *CreateZoneFrame(TimeAdmin *ta) TimeZoneFrame = gtk_frame_new (_("Time Zone")); gtk_widget_set_size_request(TimeZoneFrame,300,200); gtk_frame_set_shadow_type(GTK_FRAME(TimeZoneFrame),GTK_SHADOW_NONE); - + return TimeZoneFrame; -} +} static GtkWidget *CreateZoneScrolled(TimeAdmin *ta) { GtkWidget *Scrolled; @@ -364,11 +364,11 @@ static GtkWidget *CreateZoneScrolled(TimeAdmin *ta) GTK_SHADOW_IN); return Scrolled; -} +} static void CreateZoneEntry(TimeAdmin *ta) { GtkWidget *hbox; - + ta->TimezoneEntry = gtk_search_entry_new (); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); gtk_widget_set_halign (hbox, GTK_ALIGN_CENTER); @@ -381,7 +381,7 @@ static void CreateZoneEntry(TimeAdmin *ta) gtk_container_add (GTK_CONTAINER (ta->SearchBar), hbox); gtk_search_bar_set_search_mode(GTK_SEARCH_BAR(ta->SearchBar),TRUE); -} +} static gboolean CityChanged(GtkEntryCompletion *completion, GtkTreeModel *model, @@ -391,9 +391,9 @@ static gboolean CityChanged(GtkEntryCompletion *completion, GtkWidget *entry; g_autofree gchar *zone = NULL; - gtk_tree_model_get (model, + gtk_tree_model_get (model, iter, - CITY_COL_ZONE, + CITY_COL_ZONE, &zone, -1); timezone_map_set_timezone (TIMEZONEMAP (self->map), zone); @@ -408,12 +408,12 @@ static void ChoooseTimezoneDone (GtkWidget *widget, { TimezoneMap *map; g_autofree gchar *ZoneCity = NULL; - - map = TIMEZONEMAP(ta->map); + + map = TIMEZONEMAP(ta->map); SetTimeZone(ta->proxy,map->location->zone); - + ZoneCity = translated_city_name(map->location); - gtk_button_set_label((GTK_BUTTON(ta->TimeZoneButton)),ZoneCity); + gtk_button_set_label((GTK_BUTTON(ta->TimeZoneButton)),ZoneCity); gtk_widget_hide_on_delete(GTK_WIDGET(ta->dialog)); } @@ -439,12 +439,12 @@ void SetupTimezoneDialog(TimeAdmin *ta) ta->TZclose = DialogAddButtonWithIconName(GTK_DIALOG(ta->dialog), _("Close"), "window-close", - GTK_RESPONSE_CANCEL); - + GTK_RESPONSE_CANCEL); + ta->TZconfire = DialogAddButtonWithIconName(GTK_DIALOG(ta->dialog), _("Confirm"), "emblem-default", - GTK_RESPONSE_OK); + GTK_RESPONSE_OK); g_signal_connect (ta->TZconfire, "clicked", G_CALLBACK (ChoooseTimezoneDone), @@ -455,9 +455,9 @@ void SetupTimezoneDialog(TimeAdmin *ta) G_CALLBACK (ChoooseTimezoneClose), ta); - Vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + Vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_style_context_add_class (gtk_widget_get_style_context (Vbox), "linked"); - + TimeZoneFrame = CreateZoneFrame(ta); Scrolled = CreateZoneScrolled(ta); @@ -470,11 +470,11 @@ void SetupTimezoneDialog(TimeAdmin *ta) gtk_container_add (GTK_CONTAINER (Scrolled),ta->map); gtk_box_pack_start(GTK_BOX(Vbox),TimeZoneFrame,TRUE,TRUE,10); get_initial_timezone(ta); - + g_signal_connect(gtk_entry_get_completion (GTK_ENTRY (ta->TimezoneEntry)), - "match-selected", - G_CALLBACK (CityChanged), - ta); + "match-selected", + G_CALLBACK (CityChanged), + ta); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (ta->dialog))), Vbox, @@ -484,7 +484,7 @@ void SetupTimezoneDialog(TimeAdmin *ta) void tz_info_free (TzInfo *tzinfo) { g_return_if_fail (tzinfo != NULL); - + if (tzinfo->tzname_normal) g_free (tzinfo->tzname_normal); if (tzinfo->tzname_daylight) g_free (tzinfo->tzname_daylight); g_free (tzinfo); @@ -535,18 +535,18 @@ compare_timezones (const char *a, char *tz_info_get_clean_name (TzDB *tz_db, const char *tz) -{ +{ char *ret; const char *timezone; guint i; gboolean replaced; - + /* Remove useless prefixes */ if (g_str_has_prefix (tz, "right/")) tz = tz + strlen ("right/"); else if (g_str_has_prefix (tz, "posix/")) tz = tz + strlen ("posix/"); - + /* Here start the crazies */ replaced = FALSE; @@ -625,7 +625,7 @@ TzInfo *tz_info_from_location (TzLocation *loc) glong tz_location_get_utc_offset (TzLocation *loc) { g_autoptr(TzInfo) tz_info = NULL; - glong offset; + glong offset; tz_info = tz_info_from_location (loc); offset = tz_info->utc_offset; diff --git a/capplets/time-admin/src/time-zone.h b/capplets/time-admin/src/time-zone.h index a0c993d5..70473b24 100644 --- a/capplets/time-admin/src/time-zone.h +++ b/capplets/time-admin/src/time-zone.h @@ -1,4 +1,4 @@ -/* time-admin +/* time-admin * Copyright (C) 2018 zhuyaliang https://github.com/zhuyaliang/ * * This program is free software: you can redistribute it and/or modify @@ -27,13 +27,13 @@ #endif typedef struct TzDB -{ +{ GPtrArray *locations; GHashTable *backward; }TzDB; - + typedef struct TzLocation -{ +{ gchar *country; gdouble latitude; gdouble longitude; |