Change some functions to use icon names instead of stock id's

This commit is contained in:
Robert Fewell 2017-06-27 13:57:47 +01:00
parent dc0d8727f5
commit 75f17b6742
9 changed files with 22 additions and 21 deletions

View File

@ -484,17 +484,18 @@ gnc_builder_connect_full_func(GtkBuilder *builder,
void
gnc_gtk_dialog_add_button (GtkWidget *dialog, const gchar *label, const gchar *stock_id, guint response)
gnc_gtk_dialog_add_button (GtkWidget *dialog, const gchar *label, const gchar *icon_name, guint response)
{
GtkWidget *button;
button = gtk_button_new_with_mnemonic(label);
if (stock_id)
if (icon_name)
{
GtkWidget *image;
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image(GTK_BUTTON(button), image);
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON(button), image);
g_object_set (button, "always-show-image", TRUE, NULL); // Maybe this should be a preference
}
g_object_set (button, "can-default", TRUE, NULL);
gtk_widget_show_all(button);

View File

@ -87,13 +87,13 @@ void gnc_builder_connect_full_func (GtkBuilder *builder,
*
* @param label The text of the button.
*
* @param stock_id The name of the stock button to use.
* @param icon_name The name of the icon button to use.
*
* @param response The response id to return if this button is
* clicked.*/
void gnc_gtk_dialog_add_button (GtkWidget *dialog,
const gchar *label,
const gchar *stock_id,
const gchar *icon_name,
guint response);
/** Note: This dialog is modal! (It calls gtk_dialog_run() which is modal.)

View File

@ -791,11 +791,11 @@ RESTART:
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
gnc_gtk_dialog_add_button(dialog, _("_Open Read-Only"),
_("Revert"), RESPONSE_READONLY);
"document-revert", RESPONSE_READONLY);
gnc_gtk_dialog_add_button(dialog, _("_Create New File"),
_("New"), RESPONSE_NEW);
"document-new", RESPONSE_NEW);
gnc_gtk_dialog_add_button(dialog, _("Open _Anyway"),
_("Open"), RESPONSE_OPEN);
"document-open", RESPONSE_OPEN);
if (shutdown_cb)
gtk_dialog_add_button(GTK_DIALOG(dialog),
_("Quit"), RESPONSE_QUIT);

View File

@ -2936,7 +2936,7 @@ gnc_main_window_open_page (GncMainWindow *window,
if (icon != NULL)
{
image = gtk_image_new_from_stock (icon, GTK_ICON_SIZE_MENU);
image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_MENU);
gtk_widget_show (image);
gtk_box_pack_start (GTK_BOX (tab_hbox), image, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (tab_hbox), label, TRUE, TRUE, 0);

View File

@ -886,7 +886,7 @@ gnc_tree_control_split_reg_reinit (GncTreeViewSplitReg *view, gpointer data)
gtk_dialog_add_button (GTK_DIALOG (dialog),
_("Cancel"), GTK_RESPONSE_CANCEL);
gnc_gtk_dialog_add_button(dialog, _("_Remove Splits"),
_("Delete"), GTK_RESPONSE_ACCEPT);
"edit-delete", GTK_RESPONSE_ACCEPT);
response = gnc_dialog_run (GTK_DIALOG(dialog), warning);
gtk_widget_destroy (dialog);
if (response != GTK_RESPONSE_ACCEPT)
@ -1023,7 +1023,7 @@ gnc_tree_control_split_reg_delete (GncTreeViewSplitReg *view, gpointer data)
gtk_dialog_add_button (GTK_DIALOG (dialog),
_("Cancel"), GTK_RESPONSE_CANCEL);
gnc_gtk_dialog_add_button (dialog, _("_Delete Split"),
_("Delete"), GTK_RESPONSE_ACCEPT);
"edit-delete", GTK_RESPONSE_ACCEPT);
response = gnc_dialog_run (GTK_DIALOG (dialog), warning);
gtk_widget_destroy (dialog);
if (response != GTK_RESPONSE_ACCEPT)
@ -1063,7 +1063,7 @@ gnc_tree_control_split_reg_delete (GncTreeViewSplitReg *view, gpointer data)
gtk_dialog_add_button (GTK_DIALOG (dialog),
_("Cancel"), GTK_RESPONSE_CANCEL);
gnc_gtk_dialog_add_button (dialog, _("_Delete Transaction"),
_("Delete"), GTK_RESPONSE_ACCEPT);
"edit-delete", GTK_RESPONSE_ACCEPT);
response = gnc_dialog_run (GTK_DIALOG (dialog), warning);
gtk_widget_destroy (dialog);
if (response != GTK_RESPONSE_ACCEPT)

View File

@ -1569,11 +1569,11 @@ gnc_plugin_page_register_finish_pending (GncPluginPage *page)
"Would you like to save the changes to this transaction, "
"discard the transaction, or cancel the operation?"));
gnc_gtk_dialog_add_button(dialog, _("_Discard Transaction"),
_("Delete"), GTK_RESPONSE_REJECT);
"edit-delete", GTK_RESPONSE_REJECT);
gtk_dialog_add_button(GTK_DIALOG(dialog),
_("Cancel"), GTK_RESPONSE_CANCEL);
gnc_gtk_dialog_add_button(dialog, _("_Save Transaction"),
_("Save"), GTK_RESPONSE_ACCEPT);
"document-save", GTK_RESPONSE_ACCEPT);
response = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);

View File

@ -1626,11 +1626,11 @@ gnc_plugin_page_register2_finish_pending (GncPluginPage *page) //this works
"Would you like to save the changes to this transaction, "
"discard the transaction, or cancel the operation?"));
gnc_gtk_dialog_add_button (dialog, _("_Discard Transaction"),
_("Delete"), GTK_RESPONSE_REJECT);
"edit-delete", GTK_RESPONSE_REJECT);
gtk_dialog_add_button (GTK_DIALOG (dialog),
_("Cancel"), GTK_RESPONSE_CANCEL);
gnc_gtk_dialog_add_button (dialog, _("_Save Transaction"),
_("Save"), GTK_RESPONSE_ACCEPT);
"document-save", GTK_RESPONSE_ACCEPT);
response = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);

View File

@ -872,7 +872,7 @@ gsr_default_reinit_handler( GNCSplitReg *gsr, gpointer data )
gtk_dialog_add_button(GTK_DIALOG(dialog),
_("Cancel"), GTK_RESPONSE_CANCEL);
gnc_gtk_dialog_add_button(dialog, _("_Remove Splits"),
_("Delete"), GTK_RESPONSE_ACCEPT);
"edit-delete", GTK_RESPONSE_ACCEPT);
response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
gtk_widget_destroy (dialog);
if (response != GTK_RESPONSE_ACCEPT)
@ -1253,7 +1253,7 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
gtk_dialog_add_button(GTK_DIALOG(dialog),
_("Cancel"), GTK_RESPONSE_CANCEL);
gnc_gtk_dialog_add_button(dialog, _("_Delete Split"),
_("Delete"), GTK_RESPONSE_ACCEPT);
"edit-delete", GTK_RESPONSE_ACCEPT);
response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
gtk_widget_destroy (dialog);
if (response != GTK_RESPONSE_ACCEPT)
@ -1293,7 +1293,7 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
gtk_dialog_add_button(GTK_DIALOG(dialog),
_("Cancel"), GTK_RESPONSE_CANCEL);
gnc_gtk_dialog_add_button(dialog, _("_Delete Transaction"),
_("Delete"), GTK_RESPONSE_ACCEPT);
"edit-delete", GTK_RESPONSE_ACCEPT);
response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
gtk_widget_destroy (dialog);
if (response != GTK_RESPONSE_ACCEPT)

View File

@ -118,7 +118,7 @@ gnumeric_create_popup_menu_list (GSList *elements,
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
if (pix_name != NULL)
{
GtkWidget *image = gtk_image_new_from_stock (pix_name,
GtkWidget *image = gtk_image_new_from_icon_name (pix_name,
GTK_ICON_SIZE_MENU);
gtk_widget_show (image);
gtk_image_menu_item_set_image (