1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 
3 /*
4  *  File-Roller
5  *
6  *  Copyright (C) 2001, 2003 Free Software Foundation, Inc.
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef GTK_UTILS_H
23 #define GTK_UTILS_H
24 
25 #include <glib/gi18n.h>
26 #include <gio/gio.h>
27 #include <gtk/gtk.h>
28 
29 #define _GTK_LABEL_ADD _("_Add")
30 #define _GTK_LABEL_CANCEL _("_Cancel")
31 #define _GTK_LABEL_CLOSE _("_Close")
32 #define _GTK_LABEL_CREATE_ARCHIVE _("C_reate")
33 #define _GTK_LABEL_EXTRACT _("_Extract")
34 #define _GTK_LABEL_OPEN _("_Open")
35 #define _GTK_LABEL_SAVE _("_Save")
36 
37 
38 typedef struct {
39 	const char *action_name;
40 	const char *accelerator;
41 } FrAccelerator;
42 
43 int           _gtk_tree_selection_count_selected   (GtkTreeSelection *selection);
44 GtkWidget *   _gtk_message_dialog_new              (GtkWindow        *parent,
45 						    GtkDialogFlags    flags,
46 						    const char       *message,
47 						    const char       *secondary_message,
48 						    const char       *first_button_text,
49 						    ...);
50 gchar *       _gtk_request_dialog_run              (GtkWindow        *parent,
51 						    GtkDialogFlags    flags,
52 						    const char       *title,
53 						    const char       *message,
54 						    const char       *default_value,
55 						    int               max_length,
56 						    const char       *no_button_text,
57 						    const char       *yes_button_text);
58 GtkWidget *   _gtk_error_dialog_new                (GtkWindow        *parent,
59 						    GtkDialogFlags    flags,
60 						    GList            *row_output,
61 						    const char       *primary_text,
62 						    const char       *secondary_text_format,
63 						    ...) G_GNUC_PRINTF (5, 6);
64 void          _gtk_error_dialog_run                (GtkWindow        *parent,
65 						    const gchar      *main_message,
66 						    const gchar      *format,
67 						    ...);
68 void          _gtk_dialog_add_to_window_group      (GtkDialog        *dialog);
69 void          _gtk_entry_set_locale_text           (GtkEntry         *entry,
70 					     	    const char       *text);
71 char *        _gtk_entry_get_locale_text           (GtkEntry         *entry);
72 void          _gtk_label_set_locale_text           (GtkLabel         *label,
73 						    const char       *text);
74 char *        _gtk_label_get_locale_text           (GtkLabel         *label);
75 void          _gtk_entry_set_filename_text         (GtkEntry         *entry,
76 						    const char       *text);
77 char *        _gtk_entry_get_filename_text         (GtkEntry         *entry);
78 void          _gtk_label_set_filename_text         (GtkLabel         *label,
79 						    const char       *text);
80 char *        _gtk_label_get_filename_text         (GtkLabel         *label);
81 GdkPixbuf *   _g_icon_get_pixbuf                   (GIcon            *icon,
82 						    int               size,
83 						    GtkIconTheme     *icon_theme);
84 GdkPixbuf *   _g_mime_type_get_icon                (const char       *mime_type,
85 						    int               icon_size,
86 						    GtkIconTheme     *icon_theme);
87 void          _gtk_show_help_dialog                (GtkWindow        *parent,
88 						    const char       *section);
89 GtkBuilder *  _gtk_builder_new_from_file           (const char       *filename);
90 GtkBuilder *  _gtk_builder_new_from_resource       (const char       *resource_path);
91 GtkWidget *   _gtk_builder_get_widget              (GtkBuilder       *builder,
92 						    const char       *name);
93 int           _gtk_widget_lookup_for_size          (GtkWidget        *widget,
94 						    GtkIconSize       icon_size);
95 void          _gtk_entry_use_as_password_entry     (GtkEntry         *entry);
96 GtkWidget *   _gtk_menu_button_new_for_header_bar  (void);
97 GtkWidget *   _gtk_image_button_new_for_header_bar (const char       *icon_name);
98 GtkWidget *   _gtk_header_bar_create_text_button   (const char       *icon_name,
99 						    const char       *tooltip,
100 						    const char       *action_name);
101 GtkWidget *   _gtk_header_bar_create_image_button  (const char       *icon_name,
102 						    const char       *tooltip,
103 						    const char       *action_name);
104 GtkWidget *   _gtk_header_bar_create_image_toggle_button
105 						   (const char       *icon_name,
106 						    const char       *tooltip,
107 						    const char       *action_name);
108 void          _gtk_window_add_accelerator_for_action
109 						   (GtkWindow	     *window,
110 						    GtkAccelGroup    *accel_group,
111 						    const char       *action_name,
112 						    const char       *accel,
113 						    GVariant         *target);
114 void          _gtk_window_add_accelerators_from_menu
115 						   (GtkWindow        *window,
116 						    GMenuModel       *menu);
117 gboolean      _gtk_settings_get_dialogs_use_header (void);
118 void          _gtk_application_add_accelerator_for_action
119 						   (GtkApplication   *app,
120 						    const char       *action_name,
121 						    const char       *accel);
122 void	      _gtk_application_add_accelerators    (GtkApplication   *app,
123 						    const FrAccelerator *accelerators,
124 						    int               n_accelerators);
125 
126 #endif
127