Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

message.cc File Reference

#include <gtk/gtk.h>
#include <string.h>
#include <stdarg.h>
#include "kino_common.h"
#include "message.h"

Include dependency graph for message.cc:

Go to the source code of this file.

Functions

void modal_message (const char *message,...)
char * modal_prompt (const char *message,...)
int modal_confirm (const char *affirm_label, const char *close_label, const char *message,...)
void modal_message_with_parent (GtkWidget *parent, const char *message,...)
char * modal_prompt_with_parent (GtkWidget *parent, const char *message,...)
int modal_confirm_with_parent (const char *affirm_label, const char *close_label, GtkWidget *parent, const char *message,...)

Variables

GtkWidget * main_window


Function Documentation

int modal_confirm const char *  affirm_label,
const char *  close_label,
const char *  message,
  ...
 

Definition at line 65 of file message.cc.

References common, KinoCommon::getWidget(), and modal_confirm_with_parent().

Referenced by KinoCommon::importFile(), PageMagickInfo::Initialise(), KinoCommon::newFile(), and KinoCommon::savePlayListAs().

00066 {
00067     gchar* msg;
00068     va_list args;
00069     int rv = 0;
00070 
00071     va_start( args, message );
00072     msg = g_strdup_vprintf( message, args );
00073     va_end( args );
00074 
00075     rv = modal_confirm_with_parent( affirm_label, close_label, common->getWidget(), msg, NULL );
00076 
00077     g_free( msg );
00078     return rv;
00079 }

int modal_confirm_with_parent const char *  affirm_label,
const char *  close_label,
GtkWidget *  parent,
const char *  message,
  ...
 

Definition at line 164 of file message.cc.

References KinoCommon::getWidgetWindow().

Referenced by modal_confirm().

00165 {
00166     int result = GTK_RESPONSE_NONE;
00167     va_list args;
00168     GtkWidget* dialog;
00169     gchar* msg;
00170     
00171     va_start( args, message );
00172     msg = g_strdup_vprintf( message, args );
00173     va_end( args );
00174     
00175     dialog = gtk_message_dialog_new(
00176                              GTK_WINDOW( main_window ),
00177                              GTK_DIALOG_DESTROY_WITH_PARENT,
00178                              GTK_MESSAGE_WARNING,
00179                              GTK_BUTTONS_NONE,
00180                              msg );
00181                              
00182     if ( close_label != NULL )
00183         gtk_dialog_add_button( GTK_DIALOG( dialog ), close_label, GTK_RESPONSE_CLOSE );
00184     gtk_dialog_add_button( GTK_DIALOG( dialog ), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT );
00185     gtk_dialog_add_button( GTK_DIALOG( dialog ), affirm_label, GTK_RESPONSE_ACCEPT );
00186     if ( close_label != NULL )
00187         gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT, GTK_RESPONSE_CLOSE, GTK_RESPONSE_REJECT, -1);
00188     else
00189         gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT, GTK_RESPONSE_REJECT, -1);
00190     gtk_dialog_set_default_response( GTK_DIALOG( dialog ), GTK_RESPONSE_ACCEPT );
00191     gtk_window_set_title( GTK_WINDOW( dialog ), _("Question") );
00192     gtk_window_set_resizable( GTK_WINDOW( dialog ), FALSE );
00193 
00194     if(parent)
00195         gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(KinoCommon::getWidgetWindow(parent)));
00196 
00197     result = gtk_dialog_run( GTK_DIALOG( dialog ) );
00198     gtk_widget_destroy( dialog );
00199     
00200     g_free( msg );
00201     return result;
00202 }

void modal_message const char *  message,
  ...
 

Definition at line 35 of file message.cc.

References common, KinoCommon::getWidget(), and modal_message_with_parent().

Referenced by KinoCommon::appendFile(), PageMagick::AudioThread(), KinoCommon::bulkLoad(), bulkLoad(), ImageCreateFromFile::CreateFrame(), ExportStills::doExport(), ExportMJPEG::doExport(), ExportAVI::doExport(), ExportAudio::doExport(), KinoCommon::fetchProjectMetadata(), KinoCommon::insertFile(), KinoCommon::loadFile(), KinoCommon::loadPlayList(), PageMagick::PreviewFrame(), KinoCommon::publishFrame(), PageCapture::saveFrame(), KinoCommon::saveFrame(), KinoCommon::savePlayList(), KinoCommon::savePlayListAs(), KinoCommon::setPreviewSize(), PageCapture::startCapture(), and PageMagick::StartRender().

00036 {
00037     gchar* msg;
00038     va_list args;
00039 
00040     va_start( args, message );
00041     msg = g_strdup_vprintf( message, args );
00042     va_end( args );
00043 
00044     modal_message_with_parent( common->getWidget(), msg, NULL );
00045 
00046     g_free( msg );
00047 }

void modal_message_with_parent GtkWidget *  parent,
const char *  message,
  ...
 

Definition at line 81 of file message.cc.

References KinoCommon::getWidgetWindow().

Referenced by modal_message(), and on_checkbutton_v4l_toggled().

00082 {
00083     gchar* msg;
00084     va_list args;
00085 
00086     va_start( args, message );
00087     msg = g_strdup_vprintf( message, args );
00088     va_end( args );
00089 
00090     GtkWidget * dialog = gtk_message_dialog_new(
00091                                 GTK_WINDOW( main_window ),
00092                                 GTK_DIALOG_DESTROY_WITH_PARENT,
00093                                 GTK_MESSAGE_WARNING,
00094                                 GTK_BUTTONS_OK,
00095                                 msg );
00096     gtk_window_set_resizable( GTK_WINDOW( dialog ), FALSE );
00097 
00098     if(parent)
00099         gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(KinoCommon::getWidgetWindow(parent)));
00100 
00101     gtk_dialog_run( GTK_DIALOG( dialog ) );
00102     gtk_widget_destroy( dialog );
00103 
00104     g_free( msg );
00105 }

char* modal_prompt const char *  message,
  ...
 

Definition at line 49 of file message.cc.

References common, KinoCommon::getWidget(), and modal_prompt_with_parent().

Referenced by KinoCommon::newFile().

00050 {
00051     gchar* msg;
00052     va_list args;
00053     char *rv;
00054 
00055     va_start( args, message );
00056     msg = g_strdup_vprintf( message, args );
00057     va_end( args );
00058 
00059     rv = modal_prompt_with_parent( common->getWidget(), msg, NULL );
00060 
00061     g_free( msg );
00062     return rv;
00063 }

char* modal_prompt_with_parent GtkWidget *  parent,
const char *  message,
  ...
 

Definition at line 107 of file message.cc.

References KinoCommon::getWidgetWindow().

Referenced by modal_prompt().

00108 {
00109     GtkWidget *dialog, *hbox1, *hbox2, *label, *entry, *icon;
00110     char *response = NULL;
00111     gchar* msg;
00112     va_list args;
00113 
00114     va_start( args, message );
00115     msg = g_strdup_vprintf( message, args );
00116     va_end( args );
00117 
00118     /* Create the widgets */
00119 
00120     dialog = gtk_dialog_new_with_buttons( "",
00121                                         GTK_WINDOW( main_window ),
00122                                         GTK_DIALOG_DESTROY_WITH_PARENT,
00123                                         GTK_STOCK_CANCEL,
00124                                         GTK_RESPONSE_REJECT,
00125                                         GTK_STOCK_OK,
00126                                         GTK_RESPONSE_ACCEPT,
00127                                         NULL);
00128     gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT, GTK_RESPONSE_REJECT, -1);
00129     gtk_dialog_set_default_response( GTK_DIALOG( dialog ), GTK_RESPONSE_ACCEPT );
00130     gtk_dialog_set_has_separator( GTK_DIALOG( dialog ), FALSE );
00131     gtk_window_set_resizable( GTK_WINDOW( dialog ), FALSE );
00132     g_signal_connect( G_OBJECT( dialog ), "response",
00133                             G_CALLBACK( gtk_widget_hide ),
00134                             G_OBJECT( dialog ) );
00135 
00136     /* Add the label, and show everything we've added to the dialog. */
00137     hbox1 = gtk_hbox_new( FALSE, 12 );
00138     gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 6 );
00139     hbox2 = gtk_hbox_new( FALSE, 12 );
00140     gtk_container_set_border_width( GTK_CONTAINER( hbox2 ), 6 );
00141     icon = gtk_image_new_from_stock( GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG );
00142     label = gtk_label_new( msg );
00143     entry = gtk_entry_new();
00144     gtk_entry_set_activates_default( GTK_ENTRY( entry ), TRUE );
00145     gtk_container_add( GTK_CONTAINER( hbox1 ), icon );
00146     gtk_container_add( GTK_CONTAINER( hbox1 ), label );
00147     gtk_container_add( GTK_CONTAINER( hbox2 ), entry );
00148     gtk_container_add( GTK_CONTAINER( GTK_DIALOG( dialog )->vbox ), hbox1 );
00149     gtk_container_add( GTK_CONTAINER( GTK_DIALOG( dialog )->vbox ), hbox2 );
00150 
00151     if(parent)
00152         gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(KinoCommon::getWidgetWindow(parent)));
00153 
00154     gtk_widget_show_all( dialog );
00155     
00156     if ( gtk_dialog_run( GTK_DIALOG( dialog ) ) == GTK_RESPONSE_ACCEPT )
00157         response = strdup( gtk_entry_get_text( GTK_ENTRY( entry ) ) );
00158     gtk_widget_destroy( dialog );
00159     
00160     g_free( msg );
00161     return response;
00162 }


Variable Documentation

GtkWidget* main_window
 

Definition at line 45 of file main.c.


Generated on Sun Mar 11 22:12:12 2007 for Kino by  doxygen 1.4.2