Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=grape.git;a=commitdiff;h=db1cff714ebd975c3b00fa37154ddeecba00f268
commit db1cff714ebd975c3b00fa37154ddeecba00f268 Author: James Buren <r...@frugalware.org> Date: Sun Apr 4 03:44:31 2010 -0500 display_error.c/exports.h/update_action.c * add action for updating action bar diff --git a/src/display_error.c b/src/display_error.c index 99585fe..db2633e 100644 --- a/src/display_error.c +++ b/src/display_error.c @@ -20,7 +20,7 @@ #include "exports.h" -void display_error(GtkWindow *parent,const gchar *format,...) { +void display_error(SharedInfo *info,const gchar *format,...) { gchar text[512]; va_list args; GtkWidget *dialog; @@ -31,12 +31,14 @@ void display_error(GtkWindow *parent,const gchar *format,...) { va_end(args); - dialog = gtk_message_dialog_new(parent, + dialog = gtk_message_dialog_new(info->parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, text); + update_action(info,GTK_STOCK_DIALOG_ERROR,text); + gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); diff --git a/src/exports.h b/src/exports.h index 2afd373..e92f86f 100644 --- a/src/exports.h +++ b/src/exports.h @@ -42,7 +42,8 @@ GtkWidget *text_widget_new(SharedInfo *info); GtkWidget *statusbar_new(SharedInfo *info); SharedInfo *window_new(const gchar *filename); gchar *get_filename(GtkWindow *window,gboolean open); -void display_error(GtkWindow *parent,const gchar *format,...); +void update_action(SharedInfo *info,const gchar *stock,const gchar *format,...); +void display_error(SharedInfo *info,const gchar *format,...); void box_pack_widgets(GtkWidget *box,gboolean expand,...); void new_action(GtkToolButton *btn,SharedInfo *info); void save_action(GtkToolButton *btn,SharedInfo *info); diff --git a/src/update_action.c b/src/update_action.c new file mode 100644 index 0000000..36e881e --- /dev/null +++ b/src/update_action.c @@ -0,0 +1,36 @@ +// Copyright (c) 2010 James Buren +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include "exports.h" + +void update_action(SharedInfo *info,const gchar *stock,const gchar *format,...) { + va_list args; + gchar text[512]; + + gtk_image_set_from_stock(info->action_icon,stock,GTK_ICON_SIZE_MENU); + + va_start(args,format); + + g_vsnprintf(text,sizeof(text),format,args); + + va_end(args); + + gtk_label_set_text(info->action,text); +} _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git