Exemplo n.º 1
0
/**
 * message_dialog_new_multi:
 * 	@parent:		#GtkWidget * Transient parent, or NULL for none
 *  @type:			#GtkMessageType The type of message being displayed in the dialog.
 * 	@buttons:		#const gchar * An array of strings to be displayed on the dialog buttons.
 * 	@primaryText:	#const gchar * The primary text displayed in the message dialog.
 * 	@secondaryText: #const gchar * The secondary text displayed in the message dialog.
 *  
 * 	Creates a non-modal GtkMessageDialog with multiple buttons.
 *
 * Return value: #gint The response ID
 */
gint
message_dialog_new_multi(GtkWidget * parent, GtkMessageType type, const gchar * buttons[],
						 const gchar * primaryText, const gchar * secondaryText)
{
	GtkWidget *dialog;
	gint response;
	int i = 0;

	dialog =
		gtk_message_dialog_new((GtkWindow *) parent, GTK_DIALOG_DESTROY_WITH_PARENT, type, GTK_BUTTONS_NONE,
							   NULL);

	message_dialog_set_text(dialog, primaryText, secondaryText);

	for (i = 0; *buttons; i++) {
		gtk_dialog_add_button(GTK_DIALOG(dialog), *buttons++, i);
	}
	/* the Gnome HIG specficies that the default response should always be the far right button) */
	gtk_dialog_set_default_response(GTK_DIALOG(dialog), i - 1);

	response = gtk_dialog_run(GTK_DIALOG(dialog));
	gtk_widget_destroy(dialog);

	return response;
}
Exemplo n.º 2
0
/**
 * message_dialog_new:
 * 	@parent:		#GtkWidget * Transient parent, or NULL for none
 *  @type:			#GtkMessageType The type of message being displayed in the dialog.
 * 	@button:		#GtkButtonsType The type of button displayed in the dialog.
 * 	@primaryText:	#const gchar * The primary text displayed in the message dialog.
 * 	@secondaryText: #const gchar * The secondary text displayed in the message dialog.
 *  
 * 	Creates a modal GtkMessageDialog with a single button.
 *
 * Return value: void
 */
void
message_dialog_new(GtkWidget * parent, GtkMessageType type, GtkButtonsType button, const gchar * primaryText,
				   const gchar * secondaryText)
{
	GtkWidget *dialog;

	dialog = gtk_message_dialog_new(GTK_WINDOW(parent), GTK_DIALOG_DESTROY_WITH_PARENT, type, button, NULL);

	message_dialog_set_text(dialog, primaryText, secondaryText);
	g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(dialog_close), NULL);
	gtk_widget_show_all(GTK_WIDGET(dialog));
}
Exemplo n.º 3
0
/**
 * message_dialog_new:
 * 	@parent:			 #GtkWidget * Transient parent, or NULL for none
 *    @type:			 #GtkMessageType The type of message being displayed in the dialog.
 * 	@button:			 #GtkButtonsType The type of button displayed in the dialog.
 * 	@primaryText:	 #const gchar * The primary text displayed in the message dialog.
 * 	@secondaryText: #const gchar * The secondary text displayed in the message dialog.
 *  
 * 	Creates a modal GtkMessageDialog with a single button.
 *
 * Return value: void
 */
void
message_dialog_new(GtkWidget *parent, 
						 GtkMessageType type, 
						 GtkButtonsType button, 
						 const gchar *primaryText, const gchar *secondaryText)
{
	GtkWidget *dialog;
		
	dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
												GTK_DIALOG_DESTROY_WITH_PARENT,
												type,
												button,
												NULL);	

	message_dialog_set_text(dialog, primaryText, secondaryText);
	
	gtk_dialog_run (GTK_DIALOG (dialog));
	gtk_widget_destroy (dialog);
}