diff options
Diffstat (limited to 'gsearchtool/src')
-rw-r--r-- | gsearchtool/src/Makefile.am | 15 | ||||
-rw-r--r-- | gsearchtool/src/gsearchtool-callbacks.c | 110 | ||||
-rw-r--r-- | gsearchtool/src/gsearchtool-callbacks.h | 35 | ||||
-rw-r--r-- | gsearchtool/src/gsearchtool-support.c | 43 | ||||
-rw-r--r-- | gsearchtool/src/gsearchtool-support.h | 35 | ||||
-rw-r--r-- | gsearchtool/src/gsearchtool.c | 225 | ||||
-rw-r--r-- | gsearchtool/src/gsearchtool.h | 35 |
7 files changed, 228 insertions, 270 deletions
diff --git a/gsearchtool/src/Makefile.am b/gsearchtool/src/Makefile.am index b116e73a..393d535d 100644 --- a/gsearchtool/src/Makefile.am +++ b/gsearchtool/src/Makefile.am @@ -1,3 +1,18 @@ +# This file is part of MATE Utils. +# +# 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. +# +# 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 MATE Utils. If not, see <https://www.gnu.org/licenses/>. + NULL = AM_CPPFLAGS = \ diff --git a/gsearchtool/src/gsearchtool-callbacks.c b/gsearchtool/src/gsearchtool-callbacks.c index 7b915658..737ca064 100644 --- a/gsearchtool/src/gsearchtool-callbacks.c +++ b/gsearchtool/src/gsearchtool-callbacks.c @@ -1,32 +1,29 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * MATE Search Tool +/* Copyright (C) 2002 the Free Software Foundation + * Copyright (C) 2012-2021 MATE Developers * - * File: gsearchtool-callbacks.c + * This file is part of MATE Utils. * - * (C) 2002 the Free Software Foundation + * 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. * - * Authors: Dennis Cranston <[email protected]> - * George Lebl + * 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. * - * 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. - * - * 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 St, Fifth Floor, Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU General Public License + * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>. * + * Authors: + * Dennis Cranston <[email protected]> + * George Lebl */ #ifdef HAVE_CONFIG_H -# include <config.h> +#include <config.h> #endif #include <string.h> @@ -200,9 +197,9 @@ click_help_cb (GtkWidget * widget, gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 14); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (gtk_widget_destroy), NULL); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + NULL); gtk_widget_show (dialog); g_error_free (error); @@ -224,7 +221,7 @@ click_expander_cb (GObject * object, GDK_HINT_MIN_SIZE); } else { - GdkGeometry default_geometry = {MINIMUM_WINDOW_WIDTH, MINIMUM_WINDOW_HEIGHT}; + GdkGeometry default_geometry = { MINIMUM_WINDOW_WIDTH, MINIMUM_WINDOW_HEIGHT, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0 }; gtk_widget_hide (gsearch->available_options_vbox); gtk_window_set_geometry_hints (GTK_WINDOW (gsearch->window), @@ -332,7 +329,6 @@ look_in_folder_changed_cb (GtkWidget * widget, g_free (value); } - static gint display_dialog_file_open_limit (GtkWidget * window, gint count) @@ -407,9 +403,9 @@ display_dialog_could_not_open_file (GtkWidget * window, gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 14); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (gtk_widget_destroy), NULL); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + NULL); gtk_widget_show (dialog); g_free (primary); @@ -436,9 +432,9 @@ display_dialog_could_not_open_folder (GtkWidget * window, gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 14); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (gtk_widget_destroy), NULL); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + NULL); gtk_widget_show (dialog); g_free (primary); @@ -739,9 +735,9 @@ display_dialog_could_not_move_to_trash (GtkWidget * window, gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 14); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (gtk_widget_destroy), NULL); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + NULL); gtk_widget_show (dialog); g_free (primary); } @@ -817,9 +813,9 @@ display_dialog_could_not_delete (GtkWidget * window, gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 14); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (gtk_widget_destroy), NULL); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + NULL); gtk_widget_show (dialog); g_free (primary); } @@ -1147,8 +1143,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, gtk_container_add (GTK_CONTAINER (gsearch->search_results_popup_menu), new1); gtk_widget_show (new1); - g_signal_connect (G_OBJECT (new1), - "activate", + g_signal_connect (new1, "activate", G_CALLBACK (open_file_cb), (gpointer) gsearch); } @@ -1173,8 +1168,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, gtk_container_add (GTK_CONTAINER (gsearch->search_results_popup_menu), new1); gtk_widget_show (new1); - g_signal_connect (G_OBJECT (new1), - "activate", + g_signal_connect (new1, "activate", G_CALLBACK (open_file_cb), (gpointer) gsearch); } @@ -1261,7 +1255,8 @@ build_popup_menu_for_file (GSearchWindow * gsearch, on the parent menu item. Since submenus in gtk+ are automatically displayed when the user hovers over them, most will never click on the parent menu item. The work-around is to connect to "button-press-event". */ - g_signal_connect (G_OBJECT(new1), "button-press-event", G_CALLBACK (open_file_event_cb), + g_signal_connect (new1, "button-press-event", + G_CALLBACK (open_file_event_cb), (gpointer) gsearch); } else { @@ -1303,8 +1298,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, gtk_container_add (GTK_CONTAINER (gsearch->search_results_popup_menu), new1); gtk_widget_show (new1); - g_signal_connect (G_OBJECT (new1), - "activate", + g_signal_connect (new1, "activate", G_CALLBACK (open_folder_cb), (gpointer) gsearch); @@ -1314,8 +1308,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, gtk_container_add (GTK_CONTAINER (gsearch->search_results_popup_menu), new1); gtk_widget_show (new1); - g_signal_connect (G_OBJECT (new1), - "activate", + g_signal_connect (new1, "activate", G_CALLBACK (copy_path_cb), (gpointer) gsearch); } @@ -1334,8 +1327,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, gtk_container_add (GTK_CONTAINER (gsearch->search_results_popup_menu), new1); gtk_widget_show (new1); - g_signal_connect (G_OBJECT (new1), - "activate", + g_signal_connect (new1, "activate", G_CALLBACK (move_to_trash_cb), (gpointer) gsearch); @@ -1352,8 +1344,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, gtk_widget_set_sensitive (gsearch->search_results_save_results_as_item, FALSE); } - g_signal_connect (G_OBJECT (gsearch->search_results_save_results_as_item), - "activate", + g_signal_connect (gsearch->search_results_save_results_as_item, "activate", G_CALLBACK (show_file_selector_cb), (gpointer) gsearch); } @@ -1623,7 +1614,7 @@ drag_begin_file_cb (GtkWidget * widget, number_of_selected_rows = gtk_tree_selection_count_selected_rows (GTK_TREE_SELECTION (gsearch->search_results_selection)); if (number_of_selected_rows > 1) { - gtk_drag_set_icon_stock (context, "gtk-dnd-multiple", 0, 0); + gtk_drag_set_icon_name (context, "gtk-dnd-multiple", 0, 0); } else if (number_of_selected_rows == 1) { GdkPixbuf * pixbuf; @@ -1646,7 +1637,7 @@ drag_begin_file_cb (GtkWidget * widget, gtk_drag_set_icon_pixbuf (context, pixbuf, 0, 0); } else { - gtk_drag_set_icon_stock (context, "gtk-dnd", 0, 0); + gtk_drag_set_icon_name (context, "gtk-dnd", 0, 0); } } } @@ -1714,7 +1705,6 @@ drag_file_cb (GtkWidget * widget, g_free (uri_list); } - void show_file_selector_cb (GtkAction * action, gpointer data) @@ -1735,7 +1725,7 @@ show_file_selector_cb (GtkAction * action, gsearch->save_results_as_default_filename); } - g_signal_connect (G_OBJECT (file_chooser), "response", + g_signal_connect (file_chooser, "response", G_CALLBACK (save_results_cb), gsearch); gtk_window_set_modal (GTK_WINDOW (file_chooser), TRUE); @@ -1766,9 +1756,9 @@ display_dialog_could_not_save_no_name (GtkWidget * window) gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 14); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (gtk_widget_destroy), NULL); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + NULL); gtk_widget_show (dialog); g_free (primary); g_free (secondary); @@ -1798,9 +1788,9 @@ display_dialog_could_not_save_to (GtkWidget * window, gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 14); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (gtk_widget_destroy), NULL); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + NULL); gtk_widget_show (dialog); g_free (primary); } diff --git a/gsearchtool/src/gsearchtool-callbacks.h b/gsearchtool/src/gsearchtool-callbacks.h index 4ee01113..737aefe9 100644 --- a/gsearchtool/src/gsearchtool-callbacks.h +++ b/gsearchtool/src/gsearchtool-callbacks.h @@ -1,28 +1,25 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * MATE Search Tool +/* Copyright (C) 2002 The Free Software Foundation + * Copyright (C) 2012-2021 MATE Developers * - * File: gsearchtool-callbacks.h + * This file is part of MATE Utils. * - * (C) 2002 the Free Software Foundation + * 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. * - * Authors: Dennis Cranston <[email protected]> - * George Lebl + * 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. * - * 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. - * - * 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 St, Fifth Floor, Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU General Public License + * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>. * + * Authors: + * Dennis Cranston <[email protected]> + * George Lebl */ #ifndef _GSEARCHTOOL_CALLBACKS_H_ diff --git a/gsearchtool/src/gsearchtool-support.c b/gsearchtool/src/gsearchtool-support.c index 54d1475a..0a56c6a9 100644 --- a/gsearchtool/src/gsearchtool-support.c +++ b/gsearchtool/src/gsearchtool-support.c @@ -1,32 +1,29 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * MATE Search Tool +/* Copyright (C) 2002 the Free Software Foundation + * Copyright (C) 2012-2021 MATE Developers * - * File: gsearchtool-support.c + * This file is part of MATE Utils. * - * (C) 2002 the Free Software Foundation + * 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. * - * Authors: Dennis Cranston <[email protected]> - * George Lebl + * 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. * - * 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. - * - * 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 St, Fifth Floor, Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU General Public License + * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>. * + * Authors: + * Dennis Cranston <[email protected]> + * George Lebl */ #ifdef HAVE_CONFIG_H -# include <config.h> +#include <config.h> #endif #include <string.h> @@ -449,10 +446,10 @@ get_file_type_description (const gchar * file, } if (content_type == NULL || g_content_type_is_unknown (content_type) == TRUE) { - return g_strdup (g_content_type_get_description ("application/octet-stream")); + return g_content_type_get_description ("application/octet-stream"); } - desc = g_strdup (g_content_type_get_description (content_type)); + desc = g_content_type_get_description (content_type); if (g_file_info_get_is_symlink (file_info) == TRUE) { @@ -747,8 +744,6 @@ get_themed_icon_pixbuf (GThemedIcon * icon, return pixbuf; } - - GdkPixbuf * get_file_pixbuf (GSearchWindow * gsearch, GFileInfo * file_info) diff --git a/gsearchtool/src/gsearchtool-support.h b/gsearchtool/src/gsearchtool-support.h index cca3846f..48bcbc05 100644 --- a/gsearchtool/src/gsearchtool-support.h +++ b/gsearchtool/src/gsearchtool-support.h @@ -1,28 +1,25 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * MATE Search Tool +/* Copyright (C) 2002 The Free Software Foundation + * Copyright (C) 2012-2021 MATE Developers * - * File: gsearchtool-support.h + * This file is part of MATE Utils. * - * (C) 2002 the Free Software Foundation + * 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. * - * Authors: Dennis Cranston <[email protected]> - * George Lebl + * 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. * - * 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. - * - * 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 St, Fifth Floor, Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU General Public License + * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>. * + * Authors: + * Dennis Cranston <[email protected]> + * George Lebl */ #ifndef _GSEARCHTOOL_SUPPORT_H_ diff --git a/gsearchtool/src/gsearchtool.c b/gsearchtool/src/gsearchtool.c index bdc1561a..528f3783 100644 --- a/gsearchtool/src/gsearchtool.c +++ b/gsearchtool/src/gsearchtool.c @@ -1,37 +1,34 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * MATE Search Tool - * - * File: gsearchtool.c - * - * (C) 1998,2002 the Free Software Foundation +/* Copyright (C) 1998, 2002 the Free Software Foundation + * Copyright (C) 2012-2021 MATE Developers * - * Authors: Dennis Cranston <[email protected]> - * George Lebl + * 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, - * 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. + * 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. + * You should have received a copy of the GNU General Public License + * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>. * + * Authors: + * Dennis Cranston <[email protected]> + * George Lebl */ #ifdef HAVE_CONFIG_H -# include <config.h> +#include <config.h> #endif #include <fnmatch.h> #ifndef FNM_CASEFOLD -# define FNM_CASEFOLD 0 +#define FNM_CASEFOLD 0 #endif #include <string.h> @@ -44,7 +41,10 @@ #include <glib/gi18n.h> #include <gdk/gdk.h> #include <gio/gio.h> + +#ifdef ENABLE_NLS #include <locale.h> +#endif /* ENABLE_NLS */ #include "gsearchtool.h" #include "gsearchtool-callbacks.h" @@ -52,7 +52,6 @@ #include "gsearchtool-entry.h" #define MATE_SEARCH_TOOL_DEFAULT_ICON_SIZE 16 -#define MATE_SEARCH_TOOL_STOCK "panel-searchtool" #define MATE_SEARCH_TOOL_REFRESH_DURATION 50000 #define LEFT_LABEL_SPACING " " @@ -175,7 +174,7 @@ static GOptionEntry GSearchGOptionEntries[] = { { "hidden", 0, 0, G_OPTION_ARG_NONE, &GSearchGOptionArguments.hidden, NULL, NULL }, { "follow", 0, 0, G_OPTION_ARG_NONE, &GSearchGOptionArguments.follow, NULL, NULL }, { "mounts", 0, 0, G_OPTION_ARG_NONE, &GSearchGOptionArguments.mounts, NULL, NULL }, - { NULL } + { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL } }; static gchar * find_command_default_name_argument; @@ -494,9 +493,9 @@ display_dialog_character_set_conversion_error (GtkWidget * window, gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 14); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (gtk_widget_destroy), NULL); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + NULL); gtk_widget_show (dialog); } @@ -1771,9 +1770,9 @@ handle_search_command_stderr_io (GIOChannel * ioc, gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, FALSE, 0); gtk_widget_show_all (hbox); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (gtk_widget_destroy), NULL); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + NULL); gtk_widget_show (dialog); } @@ -1822,9 +1821,9 @@ handle_search_command_stderr_io (GIOChannel * ioc, gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_OK); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (disable_quick_search_cb), (gpointer) gsearch); + g_signal_connect (dialog, "response", + G_CALLBACK (disable_quick_search_cb), + (gpointer) gsearch); gtk_widget_show (dialog); } @@ -2041,11 +2040,12 @@ create_constraint_box (GSearchWindow * gsearch, gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (entry)); - g_signal_connect (G_OBJECT (entry), "changed", - G_CALLBACK (constraint_update_info_cb), opt); + g_signal_connect (entry, "changed", + G_CALLBACK (constraint_update_info_cb), + opt); - g_signal_connect (G_OBJECT (entry), "activate", - G_CALLBACK (constraint_activate_cb), + g_signal_connect (entry, "activate", + G_CALLBACK (constraint_activate_cb), (gpointer) gsearch); /* add text field */ @@ -2082,7 +2082,7 @@ create_constraint_box (GSearchWindow * gsearch, list = g_list_append (list, (gpointer) gsearch); list = g_list_append (list, (gpointer) opt); - g_signal_connect (G_OBJECT (button), "clicked", + g_signal_connect (button, "clicked", G_CALLBACK (remove_constraint_cb), (gpointer) list); @@ -2229,8 +2229,9 @@ create_additional_constraint_section (GSearchWindow * gsearch) gsearch->available_options_button_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH); gtk_size_group_add_widget (gsearch->available_options_button_size_group, gsearch->available_options_add_button); - g_signal_connect (G_OBJECT (gsearch->available_options_add_button),"clicked", - G_CALLBACK (add_constraint_cb), (gpointer) gsearch); + g_signal_connect (gsearch->available_options_add_button, "clicked", + G_CALLBACK (add_constraint_cb), + (gpointer) gsearch); if (gsearch->is_window_accessible) { add_atk_namedesc (GTK_WIDGET (gsearch->available_options_add_button), _("Add search option"), @@ -2379,43 +2380,35 @@ create_search_results_section (GSearchWindow * gsearch) GSearchDndTable, GSearchTotalDnds, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK); - g_signal_connect (G_OBJECT (gsearch->search_results_tree_view), - "drag_data_get", - G_CALLBACK (drag_file_cb), - (gpointer) gsearch); + g_signal_connect (gsearch->search_results_tree_view, "drag_data_get", + G_CALLBACK (drag_file_cb), + (gpointer) gsearch); - g_signal_connect (G_OBJECT (gsearch->search_results_tree_view), - "drag_begin", - G_CALLBACK (drag_begin_file_cb), - (gpointer) gsearch); + g_signal_connect (gsearch->search_results_tree_view, "drag_begin", + G_CALLBACK (drag_begin_file_cb), + (gpointer) gsearch); - g_signal_connect (G_OBJECT (gsearch->search_results_tree_view), - "event_after", - G_CALLBACK (file_event_after_cb), - (gpointer) gsearch); + g_signal_connect (gsearch->search_results_tree_view, "event_after", + G_CALLBACK (file_event_after_cb), + (gpointer) gsearch); - g_signal_connect (G_OBJECT (gsearch->search_results_tree_view), - "button_release_event", - G_CALLBACK (file_button_release_event_cb), - (gpointer) gsearch); + g_signal_connect (gsearch->search_results_tree_view, "button_release_event", + G_CALLBACK (file_button_release_event_cb), + (gpointer) gsearch); - g_signal_connect (G_OBJECT (gsearch->search_results_tree_view), - "button_press_event", - G_CALLBACK (file_button_press_event_cb), - (gpointer) gsearch->search_results_tree_view); + g_signal_connect (gsearch->search_results_tree_view, "button_press_event", + G_CALLBACK (file_button_press_event_cb), + (gpointer) gsearch->search_results_tree_view); - g_signal_connect (G_OBJECT (gsearch->search_results_tree_view), - "key_press_event", + g_signal_connect (gsearch->search_results_tree_view, "key_press_event", G_CALLBACK (file_key_press_event_cb), (gpointer) gsearch); - g_signal_connect (G_OBJECT (gsearch->search_results_tree_view), - "motion_notify_event", + g_signal_connect (gsearch->search_results_tree_view, "motion_notify_event", G_CALLBACK (file_motion_notify_cb), (gpointer) gsearch); - g_signal_connect (G_OBJECT (gsearch->search_results_tree_view), - "leave_notify_event", + g_signal_connect (gsearch->search_results_tree_view, "leave_notify_event", G_CALLBACK (file_leave_notify_cb), (gpointer) gsearch); @@ -2499,46 +2492,12 @@ create_search_results_section (GSearchWindow * gsearch) gsearchtool_set_columns_order (gsearch->search_results_tree_view); - g_signal_connect (G_OBJECT (gsearch->search_results_tree_view), - "columns-changed", + g_signal_connect (gsearch->search_results_tree_view, "columns-changed", G_CALLBACK (columns_changed_cb), (gpointer) gsearch); return vbox; } -static void -register_gsearchtool_icon (GtkIconFactory * factory) -{ - GtkIconSource * source; - GtkIconSet * icon_set; - - source = gtk_icon_source_new (); - - gtk_icon_source_set_icon_name (source, MATE_SEARCH_TOOL_ICON); - - icon_set = gtk_icon_set_new (); - gtk_icon_set_add_source (icon_set, source); - - gtk_icon_factory_add (factory, MATE_SEARCH_TOOL_STOCK, icon_set); - - gtk_icon_set_unref (icon_set); - - gtk_icon_source_free (source); -} - -static void -gsearchtool_init_stock_icons (void) -{ - GtkIconFactory * factory; - - factory = gtk_icon_factory_new (); - gtk_icon_factory_add_default (factory); - - register_gsearchtool_icon (factory); - - g_object_unref (factory); -} - void set_clone_command (GSearchWindow * gsearch, gint * argcp, @@ -2784,7 +2743,7 @@ gsearch_app_create (GSearchWindow * gsearch) gsearch->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gsearch->is_window_maximized = g_settings_get_boolean (gsearch->mate_search_tool_settings, "default-window-maximized"); - g_signal_connect (G_OBJECT (gsearch->window), "size-allocate", + g_signal_connect (gsearch->window, "size-allocate", G_CALLBACK (gsearch_window_size_allocate), gsearch); gsearch->command_details = g_slice_new0 (GSearchCommandDetails); @@ -2835,7 +2794,7 @@ gsearch_app_create (GSearchWindow * gsearch) add_atk_namedesc (gsearch->name_contains_entry, NULL, _("Enter a filename or partial filename with or without wildcards.")); add_atk_namedesc (entry, _("Name contains"), _("Enter a filename or partial filename with or without wildcards.")); } - g_signal_connect (G_OBJECT (gsearch_history_entry_get_entry (GSEARCH_HISTORY_ENTRY (gsearch->name_contains_entry))), "activate", + g_signal_connect (gsearch_history_entry_get_entry (GSEARCH_HISTORY_ENTRY (gsearch->name_contains_entry)), "activate", G_CALLBACK (name_contains_activate_cb), (gpointer) gsearch); @@ -2850,9 +2809,9 @@ gsearch_app_create (GSearchWindow * gsearch) gtk_widget_set_hexpand (gsearch->look_in_folder_button, TRUE); gtk_grid_attach (GTK_GRID (gsearch->name_and_folder_table), gsearch->look_in_folder_button, 1, 1, 1, 1); - g_signal_connect (G_OBJECT (gsearch->look_in_folder_button), "current-folder-changed", + g_signal_connect (gsearch->look_in_folder_button, "current-folder-changed", G_CALLBACK (look_in_folder_changed_cb), - (gpointer) gsearch); + (gpointer) gsearch); if (gsearch->is_window_accessible) { add_atk_namedesc (GTK_WIDGET (gsearch->look_in_folder_button), _("Look in folder"), _("Select the folder or device from which you want to begin the search.")); @@ -2875,8 +2834,9 @@ gsearch_app_create (GSearchWindow * gsearch) gsearch->show_more_options_expander = gtk_expander_new_with_mnemonic (_("Select more _options")); gtk_box_pack_start (GTK_BOX (container), gsearch->show_more_options_expander, FALSE, FALSE, 0); - g_signal_connect (G_OBJECT (gsearch->show_more_options_expander), "notify::expanded", - G_CALLBACK (click_expander_cb), (gpointer) gsearch); + g_signal_connect (gsearch->show_more_options_expander, "notify::expanded", + G_CALLBACK (click_expander_cb), + (gpointer) gsearch); create_additional_constraint_section (gsearch); gtk_box_pack_start (GTK_BOX (container), GTK_WIDGET (gsearch->available_options_vbox), FALSE, FALSE, 0); @@ -2906,12 +2866,12 @@ gsearch_app_create (GSearchWindow * gsearch) "use-underline", TRUE, NULL)); - gtk_widget_set_can_default (button, TRUE); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (hbox), button, TRUE); - g_signal_connect (G_OBJECT (button), "clicked", - G_CALLBACK (click_help_cb), (gpointer) gsearch->window); + g_signal_connect (button, "clicked", + G_CALLBACK (click_help_cb), + (gpointer) gsearch->window); if (gsearch->is_window_accessible) { add_atk_namedesc (GTK_WIDGET (button), NULL, _("Click to display the help manual.")); } @@ -2923,8 +2883,9 @@ gsearch_app_create (GSearchWindow * gsearch) NULL)); gtk_widget_set_can_default (button, TRUE); - g_signal_connect (G_OBJECT (button), "clicked", - G_CALLBACK (click_close_cb), (gpointer) gsearch); + g_signal_connect (button, "clicked", + G_CALLBACK (click_close_cb), + (gpointer) gsearch); if (gsearch->is_window_accessible) { add_atk_namedesc (GTK_WIDGET (button), NULL, _("Click to close \"Search for Files\".")); } @@ -2953,12 +2914,15 @@ gsearch_app_create (GSearchWindow * gsearch) gtk_widget_set_sensitive (gsearch->stop_button, FALSE); gtk_widget_set_sensitive (gsearch->find_button, TRUE); - g_signal_connect (G_OBJECT (gsearch->find_button), "clicked", - G_CALLBACK (click_find_cb), (gpointer) gsearch); - g_signal_connect (G_OBJECT (gsearch->find_button), "size_allocate", - G_CALLBACK (size_allocate_cb), (gpointer) gsearch->available_options_add_button); - g_signal_connect (G_OBJECT (gsearch->stop_button), "clicked", - G_CALLBACK (click_stop_cb), (gpointer) gsearch); + g_signal_connect (gsearch->find_button, "clicked", + G_CALLBACK (click_find_cb), + (gpointer) gsearch); + g_signal_connect (gsearch->find_button, "size_allocate", + G_CALLBACK (size_allocate_cb), + (gpointer) gsearch->available_options_add_button); + g_signal_connect (gsearch->stop_button, "clicked", + G_CALLBACK (click_stop_cb), + (gpointer) gsearch); if (gsearch->is_window_accessible) { add_atk_namedesc (GTK_WIDGET (gsearch->find_button), NULL, _("Click to perform a search.")); @@ -3008,7 +2972,8 @@ gsearch_window_get_type (void) NULL, sizeof (GSearchWindow), 0, - (GInstanceInitFunc)(void (*)(void)) gsearch_app_create + (GInstanceInitFunc)(void (*)(void)) gsearch_app_create, + NULL }; object_type = g_type_register_static (GTK_TYPE_WINDOW, "GSearchWindow", &object_info, 0); } @@ -3051,13 +3016,17 @@ main (int argc, GError * error = NULL; EggSMClient * client; +#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 (N_("- the MATE Search Tool")); +#ifdef ENABLE_NLS g_option_context_set_translation_domain(context, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ gsearch_setup_goption_descriptions (); g_option_context_add_main_entries (context, GSearchGOptionEntries, GETTEXT_PACKAGE); g_option_context_add_group (context, gtk_get_option_group (TRUE)); @@ -3074,22 +3043,20 @@ main (int argc, g_set_application_name (_("Search for Files")); gtk_window_set_default_icon_name (MATE_SEARCH_TOOL_ICON); - gsearchtool_init_stock_icons (); - window = g_object_new (GSEARCH_TYPE_WINDOW, NULL); gsearch = GSEARCH_WINDOW (window); gtk_window_set_resizable (GTK_WINDOW (gsearch->window), TRUE); - g_signal_connect (G_OBJECT (gsearch->window), "delete_event", - G_CALLBACK (quit_cb), - (gpointer) gsearch); - g_signal_connect (G_OBJECT (gsearch->window), "key_press_event", - G_CALLBACK (key_press_cb), - (gpointer) gsearch); - g_signal_connect (G_OBJECT (gsearch->window), "window_state_event", - G_CALLBACK (window_state_event_cb), - (gpointer) gsearch); + g_signal_connect (gsearch->window, "delete_event", + G_CALLBACK (quit_cb), + (gpointer) gsearch); + g_signal_connect (gsearch->window, "key_press_event", + G_CALLBACK (key_press_cb), + (gpointer) gsearch); + g_signal_connect (gsearch->window, "window_state_event", + G_CALLBACK (window_state_event_cb), + (gpointer) gsearch); if ((client = egg_sm_client_get ()) != NULL) { g_signal_connect (client, "save_state", diff --git a/gsearchtool/src/gsearchtool.h b/gsearchtool/src/gsearchtool.h index f48c13f2..f9f683eb 100644 --- a/gsearchtool/src/gsearchtool.h +++ b/gsearchtool/src/gsearchtool.h @@ -1,28 +1,25 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * MATE Search Tool +/* Copyright (C) 1998, 2002 The Free Software Foundation + * Copyright (C) 2012-2021 MATE Developers * - * File: gsearchtool.h + * This file is part of MATE Utils. * - * (C) 1998,2002 the Free Software Foundation + * 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. * - * Authors: Dennis Cranston <[email protected]> - * George Lebl + * 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. * - * 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. - * - * 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 St, Fifth Floor, Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU General Public License + * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>. * + * Authors: + * Dennis Cranston <[email protected]> + * George Lebl */ #ifndef _GSEARCHTOOL_H_ |