diff options
Diffstat (limited to 'mate-screenshot/src/mate-screenshot.c')
-rw-r--r-- | mate-screenshot/src/mate-screenshot.c | 73 |
1 files changed, 22 insertions, 51 deletions
diff --git a/mate-screenshot/src/mate-screenshot.c b/mate-screenshot/src/mate-screenshot.c index af94d1ef..9786c994 100644 --- a/mate-screenshot/src/mate-screenshot.c +++ b/mate-screenshot/src/mate-screenshot.c @@ -1,30 +1,28 @@ -/* mate-screenshot.c - Take a screenshot of the desktop - * - * Copyright (C) 2001 Jonathan Blandford <[email protected]> +/* Copyright (C) 2001 Jonathan Blandford <[email protected]> * Copyright (C) 2006 Emmanuele Bassi <[email protected]> * Copyright (C) 2008 Cosimo Cecchi <[email protected]> + * Copyright (C) 2012-2021 MATE Developers + * + * This file is part of MATE Utils. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. + * MATE Utils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * MATE Utils 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 St, Fifth Floor, Boston, MA 02110-1301 - * USA + * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>. */ -/* THERE ARE NO FEATURE REQUESTS ALLOWED */ -/* IF YOU WANT YOUR OWN FEATURE -- WRITE THE DAMN THING YOURSELF (-: */ -/* MAYBE I LIED... -jrb */ - +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + #include <gdk/gdkx.h> #include <gdk/gdkkeysyms.h> #include <sys/types.h> @@ -34,7 +32,9 @@ #include <unistd.h> #include <stdlib.h> #include <errno.h> +#ifdef ENABLE_NLS #include <locale.h> +#endif /* ENABLE_NLS */ #include <glib/gi18n.h> #include <gio/gio.h> #include <pwd.h> @@ -540,7 +540,7 @@ create_interactive_dialog (void) G_CALLBACK (interactive_dialog_response_cb), NULL); - g_signal_connect (G_OBJECT (retval), "key-press-event", + g_signal_connect (retval, "key-press-event", G_CALLBACK(key_press_cb), NULL); @@ -760,7 +760,6 @@ screenshot_dialog_response_cb (GtkDialog *d, } } - static void run_dialog (ScreenshotDialog *dialog) { @@ -1113,7 +1112,6 @@ prepare_screenshot_timeout (gpointer data) return FALSE; } - static gchar * get_desktop_dir (void) { @@ -1180,8 +1178,10 @@ load_options (void) /* Find various dirs */ last_save_dir = g_settings_get_string (settings, LAST_SAVE_DIRECTORY_KEY); - if (!last_save_dir || !last_save_dir[0]) + + if (*last_save_dir == '\0') { + g_free (last_save_dir); last_save_dir = get_desktop_dir (); } else if (last_save_dir[0] == '~') @@ -1217,36 +1217,6 @@ save_options (void) BORDER_EFFECT_KEY, border_effect); } - -static void -register_screenshooter_icon (GtkIconFactory * factory) -{ - GtkIconSource *source; - GtkIconSet *icon_set; - - source = gtk_icon_source_new (); - gtk_icon_source_set_icon_name (source, SCREENSHOOTER_ICON); - - icon_set = gtk_icon_set_new (); - gtk_icon_set_add_source (icon_set, source); - - gtk_icon_factory_add (factory, SCREENSHOOTER_ICON, icon_set); - gtk_icon_set_unref (icon_set); - gtk_icon_source_free (source); -} - -static void -screenshooter_init_stock_icons (void) -{ - GtkIconFactory *factory; - - factory = gtk_icon_factory_new (); - gtk_icon_factory_add_default (factory); - - register_screenshooter_icon (factory); - g_object_unref (factory); -} - void loop_dialog_screenshot (void) { @@ -1321,13 +1291,15 @@ main (int argc, char *argv[]) { "border-effect", 'e', 0, G_OPTION_ARG_STRING, &border_effect_arg, N_("Effect to add to the border (shadow, border or none)"), N_("effect") }, { "interactive", 'i', 0, G_OPTION_ARG_NONE, &interactive_arg, N_("Interactively set options"), NULL }, { "version", 0, 0, G_OPTION_ARG_NONE, &version_arg, N_("Print version information and exit"), NULL }, - { NULL }, + { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }, }; +#ifdef ENABLE_NLS setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ context = g_option_context_new (_("Take a picture of the screen")); g_option_context_set_ignore_unknown_options (context, FALSE); @@ -1364,7 +1336,6 @@ main (int argc, char *argv[]) } gtk_window_set_default_icon_name (SCREENSHOOTER_ICON); - screenshooter_init_stock_icons (); settings = g_settings_new (MATE_SCREENSHOT_SCHEMA); load_options (); |