00001
00018 #define GITK_LIB_C
00019 #define GITK_TEMPLATE_C
00020
00021 #include "gitkincludes.h"
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00039 static gboolean dialog_on_clicked(GitkDialogPtr const dialog,gchar * const widget_id,GitkEventPtr const event,gpointer const user_data) {
00040 gitk_log1("dialog_on_clicked(\"%s\")",widget_id);
00041 if(!strcmp(widget_id,"Okay")) {
00042 gitk_event_loop_end();
00043 return(TRUE);
00044 }
00045 return(FALSE);
00046 }
00047
00048
00054 void gitk_template_message(gchar * const text) {
00055 gitk_template_message_with_title(text,NULL);
00056 }
00057
00058
00065 void gitk_template_message_with_title(gchar * const text,gchar * const title) {
00066 gpointer const dialog=gitk_dialog_new_from_file(GIML_PATH"gitkTemplate_message.xml");
00067 if(dialog) {
00068
00069 if(title && *title) gitk_dialog_set_title(dialog,title);
00070 if(text && *text) gitk_widget_set_value(dialog,"Message","value",text);
00071 if(gitk_dialog_show(dialog,FALSE)) {
00072 gitk_log("dialog parsed and shown");
00073
00074
00075
00076 gitk_dialog_attach_callback(dialog,"Okay",GITK_EVENT_TYPE_ON_CLICKED,NULL,dialog_on_clicked);
00077
00078 gitk_log("run");
00079 gitk_event_loop_start();
00080 gitk_log("hiding");
00081 gitk_dialog_hide(dialog);
00082 }
00083 else {
00084
00085 }
00086 gitk_dialog_free(dialog);
00087 }
00088 else {
00089 gitk_printf(_("error parsing dialog => %d : %s\n"),gitk_get_error_code(),gitk_get_error_str());
00090 }
00091 }
00092