filebrowser: Don't use deprecated GtkStock

This commit is contained in:
JosephMcc 2017-02-15 18:15:41 -08:00
parent ee1448d73f
commit 5c08882ba6
4 changed files with 28 additions and 41 deletions

View File

@ -977,8 +977,7 @@ on_confirm_no_trash_cb (XedFileBrowserWidget *widget,
GTK_MESSAGE_QUESTION, GTK_MESSAGE_QUESTION,
message, message,
secondary, secondary,
GTK_STOCK_DELETE, _("_Delete"));
NULL);
g_free (secondary); g_free (secondary);
return result; return result;
@ -1013,8 +1012,7 @@ on_confirm_delete_cb (XedFileBrowserWidget *widget,
GTK_MESSAGE_QUESTION, GTK_MESSAGE_QUESTION,
message, message,
secondary, secondary,
GTK_STOCK_DELETE, _("_Delete"));
NULL);
g_free (message); g_free (message);

View File

@ -19,9 +19,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#include "xed-file-browser-utils.h" #ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib/gi18n-lib.h>
#include <xed/xed-utils.h> #include <xed/xed-utils.h>
#include "xed-file-browser-utils.h"
static GdkPixbuf * static GdkPixbuf *
process_icon_pixbuf (GdkPixbuf *pixbuf, process_icon_pixbuf (GdkPixbuf *pixbuf,
gchar const *name, gchar const *name,
@ -130,12 +136,10 @@ xed_file_browser_utils_confirmation_dialog (XedWindow *window,
GtkMessageType type, GtkMessageType type,
gchar const *message, gchar const *message,
gchar const *secondary, gchar const *secondary,
gchar const *button_stock,
gchar const *button_label) gchar const *button_label)
{ {
GtkWidget *dlg; GtkWidget *dlg;
gint ret; gint ret;
GtkWidget *button;
dlg = gtk_message_dialog_new (GTK_WINDOW (window), dlg = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_MODAL |
@ -148,25 +152,12 @@ xed_file_browser_utils_confirmation_dialog (XedWindow *window,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dlg), "%s", secondary); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dlg), "%s", secondary);
} }
/* Add a cancel button */ gtk_dialog_add_buttons (GTK_DIALOG (dlg),
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); _("_Cancel"), GTK_RESPONSE_CANCEL,
gtk_widget_show (button); button_label, GTK_RESPONSE_OK,
NULL);
gtk_widget_set_can_default (button, TRUE); gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_CANCEL);
gtk_dialog_add_action_widget (GTK_DIALOG (dlg), button, GTK_RESPONSE_CANCEL);
/* Add custom button */
button = gtk_button_new_from_stock (button_stock);
if (button_label)
{
gtk_button_set_use_stock (GTK_BUTTON (button), FALSE);
gtk_button_set_label (GTK_BUTTON (button), button_label);
}
gtk_widget_show (button);
gtk_widget_set_can_default (button, TRUE);
gtk_dialog_add_action_widget (GTK_DIALOG (dlg), button, GTK_RESPONSE_OK);
ret = gtk_dialog_run (GTK_DIALOG (dlg)); ret = gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg); gtk_widget_destroy (dlg);

View File

@ -4,22 +4,21 @@
#include <xed/xed-window.h> #include <xed/xed-window.h>
#include <gio/gio.h> #include <gio/gio.h>
GdkPixbuf *xed_file_browser_utils_pixbuf_from_theme (gchar const *name, GdkPixbuf *xed_file_browser_utils_pixbuf_from_theme (gchar const *name,
GtkIconSize size); GtkIconSize size);
GdkPixbuf *xed_file_browser_utils_pixbuf_from_icon (GIcon * icon, GdkPixbuf *xed_file_browser_utils_pixbuf_from_icon (GIcon *icon,
GtkIconSize size); GtkIconSize size);
GdkPixbuf *xed_file_browser_utils_pixbuf_from_file (GFile * file, GdkPixbuf *xed_file_browser_utils_pixbuf_from_file (GFile *file,
GtkIconSize size); GtkIconSize size);
gchar * xed_file_browser_utils_file_basename (GFile * file); gchar * xed_file_browser_utils_file_basename (GFile *file);
gboolean xed_file_browser_utils_confirmation_dialog (XedWindow * window, gboolean xed_file_browser_utils_confirmation_dialog (XedWindow *window,
GtkMessageType type, GtkMessageType type,
gchar const *message, gchar const *message,
gchar const *secondary, gchar const *secondary,
gchar const * button_stock, gchar const *button_label);
gchar const * button_label);
#endif /* __XED_FILE_BROWSER_UTILS_H__ */ #endif /* __XED_FILE_BROWSER_UTILS_H__ */

View File

@ -559,11 +559,10 @@ get_from_bookmark_file (XedFileBrowserWidget *obj,
item = (NameIcon *)data; item = (NameIcon *)data;
*name = g_strdup (item->name); *name = g_strdup (item->name);
*icon = item->icon;
if (item->icon != NULL) if (icon != NULL && item->icon != NULL)
{ {
g_object_ref (item->icon); *icon = g_object_ref (item->icon);
} }
return TRUE; return TRUE;