diff options
Diffstat (limited to 'mate-panel/libpanel-util')
23 files changed, 56 insertions, 60 deletions
diff --git a/mate-panel/libpanel-util/panel-cleanup.c b/mate-panel/libpanel-util/panel-cleanup.c index 199a7036..d615b83c 100644 --- a/mate-panel/libpanel-util/panel-cleanup.c +++ b/mate-panel/libpanel-util/panel-cleanup.c @@ -2,6 +2,7 @@ * panel-cleanup.c: utility to clean up things on exit * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-panel/libpanel-util/panel-cleanup.h b/mate-panel/libpanel-util/panel-cleanup.h index 9da5b828..7683c2a9 100644 --- a/mate-panel/libpanel-util/panel-cleanup.h +++ b/mate-panel/libpanel-util/panel-cleanup.h @@ -2,6 +2,7 @@ * panel-cleanup.h: utility to clean up things on exit * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-panel/libpanel-util/panel-color.c b/mate-panel/libpanel-util/panel-color.c index f6148aaa..15ebf686 100644 --- a/mate-panel/libpanel-util/panel-color.c +++ b/mate-panel/libpanel-util/panel-color.c @@ -17,7 +17,6 @@ rgb_to_hls (gdouble *r, gdouble *g, gdouble *b) gdouble green; gdouble blue; gdouble h, l, s; - gdouble delta; red = *r; green = *g; @@ -50,6 +49,8 @@ rgb_to_hls (gdouble *r, gdouble *g, gdouble *b) h = 0; if (max != min) { + gdouble delta; + if (l <= 0.5) s = (max - min) / (max + min); else @@ -84,26 +85,27 @@ rgb_to_hls (gdouble *r, gdouble *g, gdouble *b) static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s) { - gdouble hue; gdouble lightness; gdouble saturation; - gdouble m1, m2; - gdouble r, g, b; lightness = *l; saturation = *s; - if (lightness <= 0.5) - m2 = lightness * (1 + saturation); - else - m2 = lightness + saturation - lightness * saturation; - m1 = 2 * lightness - m2; - if (saturation == 0) { *h = lightness; *l = lightness; *s = lightness; } else { + gdouble hue; + gdouble m1, m2; + gdouble r, g, b; + + if (lightness <= 0.5) + m2 = lightness * (1 + saturation); + else + m2 = lightness + saturation - lightness * saturation; + m1 = 2 * lightness - m2; + hue = *h + 120; while (hue > 360) hue -= 360; diff --git a/mate-panel/libpanel-util/panel-error.c b/mate-panel/libpanel-util/panel-error.c index b14d225f..81867a4a 100644 --- a/mate-panel/libpanel-util/panel-error.c +++ b/mate-panel/libpanel-util/panel-error.c @@ -2,6 +2,7 @@ * panel-error.c: an easy-to-use error dialog * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * Originally based on code from panel-util.c (there was no relevant copyright * header at the time). @@ -79,9 +80,9 @@ panel_error_dialog (GtkWindow *parent, gtk_widget_show_all (dialog); if (auto_destroy) - g_signal_connect_swapped (G_OBJECT (dialog), "response", - G_CALLBACK (gtk_widget_destroy), - G_OBJECT (dialog)); + g_signal_connect_swapped (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + dialog); if (freeme) g_free (freeme); diff --git a/mate-panel/libpanel-util/panel-error.h b/mate-panel/libpanel-util/panel-error.h index c888731a..5b1c9b69 100644 --- a/mate-panel/libpanel-util/panel-error.h +++ b/mate-panel/libpanel-util/panel-error.h @@ -2,6 +2,7 @@ * panel-error.h: an easy-to-use error dialog * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * Originally based on code from panel-util.h (there was no relevant copyright * header at the time). diff --git a/mate-panel/libpanel-util/panel-glib.c b/mate-panel/libpanel-util/panel-glib.c index 70fc7610..e7cc531c 100644 --- a/mate-panel/libpanel-util/panel-glib.c +++ b/mate-panel/libpanel-util/panel-glib.c @@ -2,6 +2,7 @@ * panel-glib.c: various small extensions to glib * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * Originally based on code from panel-util.c (there was no relevant copyright * header at the time), but the code was: diff --git a/mate-panel/libpanel-util/panel-glib.h b/mate-panel/libpanel-util/panel-glib.h index 0cab22e9..aa21b347 100644 --- a/mate-panel/libpanel-util/panel-glib.h +++ b/mate-panel/libpanel-util/panel-glib.h @@ -2,6 +2,7 @@ * panel-glib.h: various small extensions to glib * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-panel/libpanel-util/panel-gtk.c b/mate-panel/libpanel-util/panel-gtk.c index a1db40fc..3672fca8 100644 --- a/mate-panel/libpanel-util/panel-gtk.c +++ b/mate-panel/libpanel-util/panel-gtk.c @@ -2,6 +2,7 @@ * panel-gtk.c: various small extensions to gtk+ * * Copyright (C) 2010 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -118,7 +119,6 @@ panel_file_chooser_dialog_new_valist (const gchar *title, { GtkWidget *result; const char *button_text = first_button_text; - gint response_id; result = g_object_new (GTK_TYPE_FILE_CHOOSER_DIALOG, "title", title, @@ -130,7 +130,7 @@ panel_file_chooser_dialog_new_valist (const gchar *title, while (button_text) { - response_id = va_arg (varargs, gint); + gint response_id = va_arg (varargs, gint); if (g_strcmp0 (button_text, "process-stop") == 0) panel_dialog_add_button (GTK_DIALOG (result), _("_Cancel"), button_text, response_id); @@ -166,7 +166,6 @@ panel_file_chooser_dialog_new (const gchar *title, return result; } - static void ensure_icon_settings (void) { diff --git a/mate-panel/libpanel-util/panel-gtk.h b/mate-panel/libpanel-util/panel-gtk.h index 3703e5a4..25ab2644 100644 --- a/mate-panel/libpanel-util/panel-gtk.h +++ b/mate-panel/libpanel-util/panel-gtk.h @@ -2,6 +2,7 @@ * panel-gtk.h: various small extensions to gtk+ * * Copyright (C) 2009-2010 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-panel/libpanel-util/panel-icon-chooser.c b/mate-panel/libpanel-util/panel-icon-chooser.c index 44d64908..26fee9af 100644 --- a/mate-panel/libpanel-util/panel-icon-chooser.c +++ b/mate-panel/libpanel-util/panel-icon-chooser.c @@ -2,6 +2,7 @@ * panel-icon-chooser.c: An icon chooser widget * * Copyright (C) 2010 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -152,17 +153,9 @@ panel_icon_chooser_dispose (GObject *object) /* remember, destroy can be run multiple times! */ - if (chooser->priv->fallback_icon_name != NULL) - g_free (chooser->priv->fallback_icon_name); - chooser->priv->fallback_icon_name = NULL; - - if (chooser->priv->icon != NULL) - g_free (chooser->priv->icon); - chooser->priv->icon = NULL; - - if (chooser->priv->icon_theme_dir != NULL) - g_free (chooser->priv->icon_theme_dir); - chooser->priv->icon_theme_dir = NULL; + g_clear_pointer (&chooser->priv->fallback_icon_name, g_free); + g_clear_pointer (&chooser->priv->icon, g_free); + g_clear_pointer (&chooser->priv->icon_theme_dir, g_free); G_OBJECT_CLASS (panel_icon_chooser_parent_class)->dispose (object); } @@ -357,7 +350,6 @@ _panel_icon_chooser_clicked (GtkButton *button) GtkWidget *filechooser; GtkWidget *toplevel; GtkWindow *parent; - char *path; gboolean filechooser_path_set; if (chooser->priv->filechooser) { @@ -382,15 +374,11 @@ _panel_icon_chooser_clicked (GtkButton *button) panel_gtk_file_chooser_add_image_preview (GTK_FILE_CHOOSER (filechooser)); - path = g_build_filename (DATADIR, "icons", NULL); gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (filechooser), - path, NULL); - g_free (path); + DATADIR "/icons", NULL); - path = g_build_filename (DATADIR, "pixmaps", NULL); gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (filechooser), - path, NULL); - g_free (path); + DATADIR "/pixmaps", NULL); filechooser_path_set = FALSE; @@ -428,14 +416,11 @@ _panel_icon_chooser_clicked (GtkButton *button) } if (!filechooser_path_set) { - char *path; /* FIXME? Use current icon theme? But there might not be a lot * of icons there... */ - path = g_build_filename (DATADIR, "icons", NULL); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filechooser), - path); - g_free (path); + DATADIR "/icons"); } gtk_window_set_destroy_with_parent (GTK_WINDOW (filechooser), TRUE); @@ -446,9 +431,9 @@ _panel_icon_chooser_clicked (GtkButton *button) chooser->priv->filechooser = filechooser; - g_signal_connect (G_OBJECT (filechooser), "destroy", - G_CALLBACK (gtk_widget_destroyed), - &chooser->priv->filechooser); + g_signal_connect (filechooser, "destroy", + G_CALLBACK (gtk_widget_destroyed), + &chooser->priv->filechooser); gtk_widget_show (filechooser); } @@ -511,8 +496,7 @@ panel_icon_chooser_set_fallback_icon_name (PanelIconChooser *chooser, if (g_strcmp0 (chooser->priv->fallback_icon_name, fallback_icon_name) == 0) return; - if (chooser->priv->fallback_icon_name) - g_free (chooser->priv->fallback_icon_name); + g_free (chooser->priv->fallback_icon_name); chooser->priv->fallback_icon_name = g_strdup (fallback_icon_name); _panel_icon_chooser_update (chooser); @@ -537,8 +521,7 @@ panel_icon_chooser_set_icon (PanelIconChooser *chooser, if (g_strcmp0 (chooser->priv->icon, icon) == 0) return; - if (chooser->priv->icon) - g_free (chooser->priv->icon); + g_free (chooser->priv->icon); chooser->priv->icon = g_strdup (icon); _panel_icon_chooser_update (chooser); diff --git a/mate-panel/libpanel-util/panel-icon-chooser.h b/mate-panel/libpanel-util/panel-icon-chooser.h index a815749a..97cb0fe6 100644 --- a/mate-panel/libpanel-util/panel-icon-chooser.h +++ b/mate-panel/libpanel-util/panel-icon-chooser.h @@ -2,6 +2,7 @@ * panel-icon-chooser.h: An icon chooser widget * * Copyright (C) 2010 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-panel/libpanel-util/panel-keyfile.c b/mate-panel/libpanel-util/panel-keyfile.c index 09d387e3..b98058c3 100644 --- a/mate-panel/libpanel-util/panel-keyfile.c +++ b/mate-panel/libpanel-util/panel-keyfile.c @@ -2,6 +2,7 @@ * panel-keyfile.c: GKeyFile extensions * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * Based on code from panel-util.c (there was no copyright header at the time) * @@ -52,8 +53,6 @@ _panel_key_file_make_executable (const gchar *path) { GFile *file; GFileInfo *info; - guint32 current_perms; - guint32 new_perms; file = g_file_new_for_path (path); @@ -71,6 +70,9 @@ _panel_key_file_make_executable (const gchar *path) } if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_MODE)) { + guint32 current_perms; + guint32 new_perms; + current_perms = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE); new_perms = current_perms | S_IXGRP | S_IXUSR | S_IXOTH; @@ -292,8 +294,7 @@ panel_key_file_remove_locale_key (GKeyFile *keyfile, locale_key, NULL)) break; - g_free (locale_key); - locale_key = NULL; + g_clear_pointer (&locale_key, g_free); } } diff --git a/mate-panel/libpanel-util/panel-keyfile.h b/mate-panel/libpanel-util/panel-keyfile.h index 8f90939d..413ae7ec 100644 --- a/mate-panel/libpanel-util/panel-keyfile.h +++ b/mate-panel/libpanel-util/panel-keyfile.h @@ -2,6 +2,7 @@ * panel-keyfile.h: GKeyFile extensions * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * Based on code from panel-util.h (there was no copyright header at the time) * @@ -33,7 +34,6 @@ extern "C" { #endif - GKeyFile *panel_key_file_new_desktop (void); gboolean panel_key_file_to_file (GKeyFile *keyfile, const gchar *file, diff --git a/mate-panel/libpanel-util/panel-launch.c b/mate-panel/libpanel-util/panel-launch.c index 7de0a02c..fb72c221 100644 --- a/mate-panel/libpanel-util/panel-launch.c +++ b/mate-panel/libpanel-util/panel-launch.c @@ -2,6 +2,7 @@ * panel-launch.c: some helpers to launch desktop files * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-panel/libpanel-util/panel-launch.h b/mate-panel/libpanel-util/panel-launch.h index 653167c1..372be078 100644 --- a/mate-panel/libpanel-util/panel-launch.h +++ b/mate-panel/libpanel-util/panel-launch.h @@ -2,6 +2,7 @@ * panel-launch.h: some helpers to launch desktop files * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-panel/libpanel-util/panel-list.c b/mate-panel/libpanel-util/panel-list.c index 9b1ad3f9..636161cf 100644 --- a/mate-panel/libpanel-util/panel-list.c +++ b/mate-panel/libpanel-util/panel-list.c @@ -2,6 +2,7 @@ * panel-list.c: GList & GSList extensions * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * Originally based on code from panel-util.c (there was no relevant copyright * header at the time), but the code was: diff --git a/mate-panel/libpanel-util/panel-list.h b/mate-panel/libpanel-util/panel-list.h index ec12a40d..7e09e368 100644 --- a/mate-panel/libpanel-util/panel-list.h +++ b/mate-panel/libpanel-util/panel-list.h @@ -2,6 +2,7 @@ * panel-list.h: GList & GSList extensions * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-panel/libpanel-util/panel-session-manager.c b/mate-panel/libpanel-util/panel-session-manager.c index ef99cad2..a4a17862 100644 --- a/mate-panel/libpanel-util/panel-session-manager.c +++ b/mate-panel/libpanel-util/panel-session-manager.c @@ -2,6 +2,7 @@ * panel-session.c: * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -38,8 +39,7 @@ panel_session_manager_finalize (GObject *object) { PanelSessionManager *manager = PANEL_SESSION_MANAGER (object); - if (manager->proxy != NULL) - g_object_unref (manager->proxy); + g_clear_object (&manager->proxy); G_OBJECT_CLASS (panel_session_manager_parent_class)->finalize (object); } diff --git a/mate-panel/libpanel-util/panel-session-manager.h b/mate-panel/libpanel-util/panel-session-manager.h index 98d09c94..fe148e9d 100644 --- a/mate-panel/libpanel-util/panel-session-manager.h +++ b/mate-panel/libpanel-util/panel-session-manager.h @@ -2,6 +2,7 @@ * panel-session.h: * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-panel/libpanel-util/panel-show.c b/mate-panel/libpanel-util/panel-show.c index 19feac90..1bc84ee7 100644 --- a/mate-panel/libpanel-util/panel-show.c +++ b/mate-panel/libpanel-util/panel-show.c @@ -2,6 +2,7 @@ * panel-show.c: a helper around gtk_show_uri * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-panel/libpanel-util/panel-show.h b/mate-panel/libpanel-util/panel-show.h index 9964319a..56a761c0 100644 --- a/mate-panel/libpanel-util/panel-show.h +++ b/mate-panel/libpanel-util/panel-show.h @@ -3,6 +3,7 @@ * or gtk_show_uri for gtk 3.20 and earlier * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-panel/libpanel-util/panel-xdg.c b/mate-panel/libpanel-util/panel-xdg.c index bcdbb5fa..361f413c 100644 --- a/mate-panel/libpanel-util/panel-xdg.c +++ b/mate-panel/libpanel-util/panel-xdg.c @@ -2,6 +2,7 @@ * panel-xdg.c: miscellaneous XDG-related functions. * * Copyright (C) 2010 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -117,18 +118,12 @@ panel_xdg_icon_name_from_icon_path (const char *path, gboolean current; theme_dir = g_file_get_child (parent, theme_name); - - current = FALSE; - if (g_file_has_prefix (file, theme_dir)) { - /* it's the current one */ - current = TRUE; - } else { - /* it's the default one */ + if ((current = g_file_has_prefix (file, theme_dir)) == FALSE) { + /* fallback icon theme? */ g_object_unref (theme_dir); theme_dir = g_file_get_child (parent, DEFAULT_THEME_NAME); current = g_file_has_prefix (file, theme_dir); } - g_object_unref (theme_dir); if (current) { diff --git a/mate-panel/libpanel-util/panel-xdg.h b/mate-panel/libpanel-util/panel-xdg.h index 359c91b2..1553c8f5 100644 --- a/mate-panel/libpanel-util/panel-xdg.h +++ b/mate-panel/libpanel-util/panel-xdg.h @@ -2,6 +2,7 @@ * panel-xdg.h: miscellaneous XDG-related functions. * * Copyright (C) 2010 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as |