Bug 578393 – convert from libglade to GtkBuilder
This commit is contained in:
parent
f22e523404
commit
3f33966167
@ -18,7 +18,7 @@ AC_PROG_CC
|
|||||||
|
|
||||||
GTK_REQUIRED=2.15.1
|
GTK_REQUIRED=2.15.1
|
||||||
|
|
||||||
PKG_CHECK_MODULES([ZENITY],[gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 glib-2.0])
|
PKG_CHECK_MODULES([ZENITY],[gtk+-2.0 >= $GTK_REQUIRED glib-2.0])
|
||||||
AC_SUBST([ZENITY_CFLAGS])
|
AC_SUBST([ZENITY_CFLAGS])
|
||||||
AC_SUBST([ZENITY_LIBS])
|
AC_SUBST([ZENITY_LIBS])
|
||||||
|
|
||||||
|
@ -4,5 +4,5 @@ src/notification.c
|
|||||||
src/scale.c
|
src/scale.c
|
||||||
src/tree.c
|
src/tree.c
|
||||||
src/util.c
|
src/util.c
|
||||||
src/zenity.glade
|
[type: gettext/glade]src/zenity.ui
|
||||||
src/option.c
|
src/option.c
|
||||||
|
@ -6,4 +6,5 @@ src/progress.c
|
|||||||
src/text.c
|
src/text.c
|
||||||
src/util.h
|
src/util.h
|
||||||
src/util.c
|
src/util.c
|
||||||
|
src/zenity.glade
|
||||||
src/zenity.h
|
src/zenity.h
|
||||||
|
@ -40,15 +40,15 @@ zenity_LDADD = \
|
|||||||
$(LIBNOTIFY_LIBS) \
|
$(LIBNOTIFY_LIBS) \
|
||||||
$(X_LIBS)
|
$(X_LIBS)
|
||||||
|
|
||||||
gladedir = $(datadir)/zenity
|
uidir = $(datadir)/zenity
|
||||||
|
|
||||||
glade_DATA = \
|
ui_DATA = \
|
||||||
zenity.glade
|
zenity.ui
|
||||||
|
|
||||||
DISTCLEANFILES= \
|
DISTCLEANFILES= \
|
||||||
gdialog
|
gdialog
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
$(glade_DATA) \
|
$(ui_DATA) \
|
||||||
gdialog \
|
gdialog \
|
||||||
gdialog.in
|
gdialog.in
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <glade/glade.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "zenity.h"
|
#include "zenity.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -38,22 +37,23 @@ static void zenity_calendar_double_click (GtkCalendar *calendar, gpointer data);
|
|||||||
void
|
void
|
||||||
zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
|
zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
|
||||||
{
|
{
|
||||||
GladeXML *glade_dialog = NULL;
|
GtkBuilder *builder;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *text;
|
GObject *text;
|
||||||
|
|
||||||
zen_cal_data = cal_data;
|
zen_cal_data = cal_data;
|
||||||
|
|
||||||
glade_dialog = zenity_util_load_glade_file ("zenity_calendar_dialog");
|
builder = zenity_util_load_ui_file ("zenity_calendar_dialog", NULL);
|
||||||
|
|
||||||
if (glade_dialog == NULL) {
|
if (builder == NULL) {
|
||||||
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glade_xml_signal_autoconnect (glade_dialog);
|
gtk_builder_connect_signals (builder, NULL);
|
||||||
|
|
||||||
dialog = glade_xml_get_widget (glade_dialog, "zenity_calendar_dialog");
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder,
|
||||||
|
"zenity_calendar_dialog"));
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (dialog), "response",
|
g_signal_connect (G_OBJECT (dialog), "response",
|
||||||
G_CALLBACK (zenity_calendar_dialog_response), data);
|
G_CALLBACK (zenity_calendar_dialog_response), data);
|
||||||
@ -66,16 +66,13 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
|
|||||||
if (data->width > -1 || data->height > -1)
|
if (data->width > -1 || data->height > -1)
|
||||||
gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height);
|
gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height);
|
||||||
|
|
||||||
text = glade_xml_get_widget (glade_dialog, "zenity_calendar_text");
|
text = gtk_builder_get_object (builder, "zenity_calendar_text");
|
||||||
|
|
||||||
if (cal_data->dialog_text)
|
if (cal_data->dialog_text)
|
||||||
gtk_label_set_markup (GTK_LABEL (text), g_strcompress (cal_data->dialog_text));
|
gtk_label_set_markup (GTK_LABEL (text), g_strcompress (cal_data->dialog_text));
|
||||||
|
|
||||||
calendar = glade_xml_get_widget (glade_dialog, "zenity_calendar");
|
calendar = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_calendar"));
|
||||||
|
|
||||||
if (glade_dialog)
|
|
||||||
g_object_unref (glade_dialog);
|
|
||||||
|
|
||||||
if (cal_data->month > 0 || cal_data->year > 0)
|
if (cal_data->month > 0 || cal_data->year > 0)
|
||||||
gtk_calendar_select_month (GTK_CALENDAR (calendar), cal_data->month - 1, cal_data->year);
|
gtk_calendar_select_month (GTK_CALENDAR (calendar), cal_data->month - 1, cal_data->year);
|
||||||
if (cal_data->day > 0)
|
if (cal_data->day > 0)
|
||||||
@ -91,6 +88,8 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
|
|||||||
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (builder);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
24
src/entry.c
24
src/entry.c
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <glade/glade.h>
|
|
||||||
#include "zenity.h"
|
#include "zenity.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@ -46,23 +45,23 @@ zenity_entry_fill_entries (GSList **entries, const gchar **args)
|
|||||||
void
|
void
|
||||||
zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
|
zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
|
||||||
{
|
{
|
||||||
GladeXML *glade_dialog = NULL;
|
GtkBuilder *builder = NULL;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *text;
|
GObject *text;
|
||||||
GSList *entries = NULL;
|
GSList *entries = NULL;
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
GtkWidget *vbox;
|
GObject *vbox;
|
||||||
|
|
||||||
glade_dialog = zenity_util_load_glade_file ("zenity_entry_dialog");
|
builder = zenity_util_load_ui_file ("zenity_entry_dialog", NULL);
|
||||||
|
|
||||||
if (glade_dialog == NULL) {
|
if (builder == NULL) {
|
||||||
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glade_xml_signal_autoconnect (glade_dialog);
|
gtk_builder_connect_signals (builder, NULL);
|
||||||
|
|
||||||
dialog = glade_xml_get_widget (glade_dialog, "zenity_entry_dialog");
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_entry_dialog"));
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (dialog), "response",
|
g_signal_connect (G_OBJECT (dialog), "response",
|
||||||
G_CALLBACK (zenity_entry_dialog_response), data);
|
G_CALLBACK (zenity_entry_dialog_response), data);
|
||||||
@ -75,12 +74,12 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
|
|||||||
if (data->width > -1 || data->height > -1)
|
if (data->width > -1 || data->height > -1)
|
||||||
gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height);
|
gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height);
|
||||||
|
|
||||||
text = glade_xml_get_widget (glade_dialog, "zenity_entry_text");
|
text = gtk_builder_get_object (builder, "zenity_entry_text");
|
||||||
|
|
||||||
if (entry_data->dialog_text)
|
if (entry_data->dialog_text)
|
||||||
gtk_label_set_text_with_mnemonic (GTK_LABEL (text), entry_data->dialog_text);
|
gtk_label_set_text_with_mnemonic (GTK_LABEL (text), entry_data->dialog_text);
|
||||||
|
|
||||||
vbox = glade_xml_get_widget (glade_dialog, "vbox4");
|
vbox = gtk_builder_get_object (builder, "vbox4");
|
||||||
|
|
||||||
zenity_entry_fill_entries(&entries, entry_data->data);
|
zenity_entry_fill_entries(&entries, entry_data->data);
|
||||||
|
|
||||||
@ -113,11 +112,10 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
|
|||||||
|
|
||||||
gtk_box_pack_end (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
|
gtk_box_pack_end (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
|
||||||
|
|
||||||
if (glade_dialog)
|
|
||||||
g_object_unref (glade_dialog);
|
|
||||||
|
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (text), entry);
|
gtk_label_set_mnemonic_widget (GTK_LABEL (text), entry);
|
||||||
|
|
||||||
|
g_object_unref (builder);
|
||||||
|
|
||||||
zenity_util_show_dialog (dialog);
|
zenity_util_show_dialog (dialog);
|
||||||
|
|
||||||
if(data->timeout_delay > 0) {
|
if(data->timeout_delay > 0) {
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <glade/glade.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "zenity.h"
|
#include "zenity.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
48
src/msg.c
48
src/msg.c
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <glade/glade.h>
|
|
||||||
#include "zenity.h"
|
#include "zenity.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@ -55,56 +54,53 @@ zenity_msg_construct_question_dialog (GtkWidget *dialog, ZenityMsgData *msg_data
|
|||||||
void
|
void
|
||||||
zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
||||||
{
|
{
|
||||||
GladeXML *glade_dialog;
|
GtkBuilder *builder;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *text;
|
GObject *text;
|
||||||
|
|
||||||
switch (msg_data->mode) {
|
switch (msg_data->mode) {
|
||||||
case ZENITY_MSG_WARNING:
|
case ZENITY_MSG_WARNING:
|
||||||
glade_dialog = zenity_util_load_glade_file ("zenity_warning_dialog");
|
builder = zenity_util_load_ui_file ("zenity_warning_dialog", NULL);
|
||||||
dialog = glade_xml_get_widget (glade_dialog, "zenity_warning_dialog");
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_warning_dialog"));
|
||||||
text = glade_xml_get_widget (glade_dialog, "zenity_warning_text");
|
text = gtk_builder_get_object (builder, "zenity_warning_text");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZENITY_MSG_QUESTION:
|
case ZENITY_MSG_QUESTION:
|
||||||
glade_dialog = zenity_util_load_glade_file ("zenity_question_dialog");
|
builder = zenity_util_load_ui_file ("zenity_question_dialog", NULL);
|
||||||
dialog = glade_xml_get_widget (glade_dialog, "zenity_question_dialog");
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_question_dialog"));
|
||||||
text = glade_xml_get_widget (glade_dialog, "zenity_question_text");
|
text = gtk_builder_get_object (builder, "zenity_question_text");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZENITY_MSG_ERROR:
|
case ZENITY_MSG_ERROR:
|
||||||
glade_dialog = zenity_util_load_glade_file ("zenity_error_dialog");
|
builder = zenity_util_load_ui_file ("zenity_error_dialog", NULL);
|
||||||
dialog = glade_xml_get_widget (glade_dialog, "zenity_error_dialog");
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_error_dialog"));
|
||||||
text = glade_xml_get_widget (glade_dialog, "zenity_error_text");
|
text = gtk_builder_get_object (builder, "zenity_error_text");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZENITY_MSG_INFO:
|
case ZENITY_MSG_INFO:
|
||||||
glade_dialog = zenity_util_load_glade_file ("zenity_info_dialog");
|
builder = zenity_util_load_ui_file ("zenity_info_dialog", NULL);
|
||||||
dialog= glade_xml_get_widget (glade_dialog, "zenity_info_dialog");
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_info_dialog"));
|
||||||
text = glade_xml_get_widget (glade_dialog, "zenity_info_text");
|
text = gtk_builder_get_object (builder, "zenity_info_text");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
glade_dialog = NULL;
|
builder = NULL;
|
||||||
dialog = NULL;
|
dialog = NULL;
|
||||||
text = NULL;
|
text = NULL;
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (dialog), "response",
|
if (builder == NULL) {
|
||||||
G_CALLBACK (zenity_msg_dialog_response), data);
|
|
||||||
|
|
||||||
if (glade_dialog == NULL) {
|
|
||||||
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glade_xml_signal_autoconnect (glade_dialog);
|
|
||||||
|
|
||||||
if (glade_dialog)
|
|
||||||
g_object_unref (glade_dialog);
|
|
||||||
|
|
||||||
|
g_signal_connect (G_OBJECT (dialog), "response",
|
||||||
|
G_CALLBACK (zenity_msg_dialog_response), data);
|
||||||
|
|
||||||
|
gtk_builder_connect_signals (builder, NULL);
|
||||||
|
|
||||||
if (data->dialog_title)
|
if (data->dialog_title)
|
||||||
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
|
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
|
||||||
|
|
||||||
@ -145,6 +141,8 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
|||||||
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (builder);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glade/glade.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <glade/glade.h>
|
|
||||||
#include "zenity.h"
|
#include "zenity.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
static GladeXML *glade_dialog;
|
static GtkBuilder *builder;
|
||||||
static ZenityData *zen_data;
|
static ZenityData *zen_data;
|
||||||
static GIOChannel *channel;
|
static GIOChannel *channel;
|
||||||
|
|
||||||
@ -57,14 +56,14 @@ zenity_progress_handle_stdin (GIOChannel *channel,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
static ZenityProgressData *progress_data;
|
static ZenityProgressData *progress_data;
|
||||||
static GtkWidget *progress_bar;
|
static GObject *progress_bar;
|
||||||
static GtkWidget *progress_label;
|
static GObject *progress_label;
|
||||||
static gint pulsate_timeout = -1;
|
static gint pulsate_timeout = -1;
|
||||||
float percentage = 0.0;
|
float percentage = 0.0;
|
||||||
|
|
||||||
progress_data = (ZenityProgressData *) data;
|
progress_data = (ZenityProgressData *) data;
|
||||||
progress_bar = glade_xml_get_widget (glade_dialog, "zenity_progress_bar");
|
progress_bar = gtk_builder_get_object (builder, "zenity_progress_bar");
|
||||||
progress_label = glade_xml_get_widget (glade_dialog, "zenity_progress_text");
|
progress_label = gtk_builder_get_object (builder, "zenity_progress_text");
|
||||||
|
|
||||||
if ((condition == G_IO_IN) || (condition == G_IO_IN + G_IO_HUP)) {
|
if ((condition == G_IO_IN) || (condition == G_IO_IN + G_IO_HUP)) {
|
||||||
GString *string;
|
GString *string;
|
||||||
@ -114,8 +113,8 @@ zenity_progress_handle_stdin (GIOChannel *channel,
|
|||||||
/* Now try to convert the thing to a number */
|
/* Now try to convert the thing to a number */
|
||||||
percentage = atoi (string->str);
|
percentage = atoi (string->str);
|
||||||
if (percentage >= 100) {
|
if (percentage >= 100) {
|
||||||
GtkWidget *button;
|
GObject *button;
|
||||||
button = glade_xml_get_widget( glade_dialog,"zenity_progress_ok_button");
|
button = gtk_builder_get_object(builder, "zenity_progress_ok_button");
|
||||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), 1.0);
|
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), 1.0);
|
||||||
gtk_widget_set_sensitive(GTK_WIDGET (button), TRUE);
|
gtk_widget_set_sensitive(GTK_WIDGET (button), TRUE);
|
||||||
gtk_widget_grab_focus(GTK_WIDGET (button));
|
gtk_widget_grab_focus(GTK_WIDGET (button));
|
||||||
@ -136,11 +135,13 @@ zenity_progress_handle_stdin (GIOChannel *channel,
|
|||||||
/* We assume that we are done, so stop the pulsating and de-sensitize the buttons */
|
/* We assume that we are done, so stop the pulsating and de-sensitize the buttons */
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
|
|
||||||
button = glade_xml_get_widget (glade_dialog, "zenity_progress_ok_button");
|
button = GTK_WIDGET (gtk_builder_get_object (builder,
|
||||||
|
"zenity_progress_ok_button"));
|
||||||
gtk_widget_set_sensitive (button, TRUE);
|
gtk_widget_set_sensitive (button, TRUE);
|
||||||
gtk_widget_grab_focus (button);
|
gtk_widget_grab_focus (button);
|
||||||
|
|
||||||
button = glade_xml_get_widget (glade_dialog, "zenity_progress_cancel_button");
|
button = GTK_WIDGET (gtk_builder_get_object (builder,
|
||||||
|
"zenity_progress_cancel_button"));
|
||||||
gtk_widget_set_sensitive (button, FALSE);
|
gtk_widget_set_sensitive (button, FALSE);
|
||||||
|
|
||||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), 1.0);
|
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), 1.0);
|
||||||
@ -150,8 +151,7 @@ zenity_progress_handle_stdin (GIOChannel *channel,
|
|||||||
pulsate_timeout = -1;
|
pulsate_timeout = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glade_dialog)
|
g_object_unref (builder);
|
||||||
g_object_unref (glade_dialog);
|
|
||||||
|
|
||||||
if (progress_data->autoclose) {
|
if (progress_data->autoclose) {
|
||||||
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
|
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
|
||||||
@ -177,20 +177,21 @@ void
|
|||||||
zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
|
zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *text;
|
GObject *text;
|
||||||
GtkWidget *progress_bar;
|
GObject *progress_bar;
|
||||||
|
|
||||||
zen_data = data;
|
zen_data = data;
|
||||||
glade_dialog = zenity_util_load_glade_file ("zenity_progress_dialog");
|
builder = zenity_util_load_ui_file ("zenity_progress_dialog", NULL);
|
||||||
|
|
||||||
if (glade_dialog == NULL) {
|
if (builder == NULL) {
|
||||||
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glade_xml_signal_autoconnect (glade_dialog);
|
gtk_builder_connect_signals (builder, NULL);
|
||||||
|
|
||||||
dialog = glade_xml_get_widget (glade_dialog, "zenity_progress_dialog");
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder,
|
||||||
|
"zenity_progress_dialog"));
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (dialog), "response",
|
g_signal_connect (G_OBJECT (dialog), "response",
|
||||||
G_CALLBACK (zenity_progress_dialog_response), data);
|
G_CALLBACK (zenity_progress_dialog_response), data);
|
||||||
@ -203,12 +204,12 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
|
|||||||
if (data->width > -1 || data->height > -1)
|
if (data->width > -1 || data->height > -1)
|
||||||
gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height);
|
gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height);
|
||||||
|
|
||||||
text = glade_xml_get_widget (glade_dialog, "zenity_progress_text");
|
text = gtk_builder_get_object (builder, "zenity_progress_text");
|
||||||
|
|
||||||
if (progress_data->dialog_text)
|
if (progress_data->dialog_text)
|
||||||
gtk_label_set_markup (GTK_LABEL (text), g_strcompress (progress_data->dialog_text));
|
gtk_label_set_markup (GTK_LABEL (text), g_strcompress (progress_data->dialog_text));
|
||||||
|
|
||||||
progress_bar = glade_xml_get_widget (glade_dialog, "zenity_progress_bar");
|
progress_bar = gtk_builder_get_object (builder, "zenity_progress_bar");
|
||||||
|
|
||||||
if (progress_data->percentage > -1)
|
if (progress_data->percentage > -1)
|
||||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar),
|
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar),
|
||||||
|
29
src/scale.c
29
src/scale.c
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <glade/glade.h>
|
|
||||||
#include "zenity.h"
|
#include "zenity.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@ -35,23 +34,24 @@ static void zenity_scale_dialog_response (GtkWidget *widget, int response, gpoin
|
|||||||
void
|
void
|
||||||
zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
|
zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
|
||||||
{
|
{
|
||||||
GladeXML *glade_dialog;
|
GtkBuilder *builder;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *text;
|
GObject *text;
|
||||||
|
|
||||||
glade_dialog = zenity_util_load_glade_file ("zenity_scale_dialog");
|
builder = zenity_util_load_ui_file ("zenity_scale_dialog", "adjustment1", NULL);
|
||||||
dialog = glade_xml_get_widget (glade_dialog, "zenity_scale_dialog");
|
|
||||||
scale = glade_xml_get_widget (glade_dialog, "zenity_scale_hscale");
|
|
||||||
text = glade_xml_get_widget (glade_dialog, "zenity_scale_text");
|
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (dialog), "response",
|
if (builder == NULL) {
|
||||||
G_CALLBACK (zenity_scale_dialog_response), data);
|
|
||||||
|
|
||||||
if (glade_dialog == NULL) {
|
|
||||||
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_scale_dialog"));
|
||||||
|
scale = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_scale_hscale"));
|
||||||
|
text = gtk_builder_get_object (builder, "zenity_scale_text");
|
||||||
|
|
||||||
|
g_signal_connect (G_OBJECT (dialog), "response",
|
||||||
|
G_CALLBACK (zenity_scale_dialog_response), data);
|
||||||
|
|
||||||
if (scale_data->min_value >= scale_data->max_value) {
|
if (scale_data->min_value >= scale_data->max_value) {
|
||||||
g_printerr (_("Maximum value must be greater than minimum value.\n"));
|
g_printerr (_("Maximum value must be greater than minimum value.\n"));
|
||||||
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
||||||
@ -65,11 +65,8 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glade_xml_signal_autoconnect (glade_dialog);
|
gtk_builder_connect_signals (builder, NULL);
|
||||||
|
|
||||||
if (glade_dialog)
|
|
||||||
g_object_unref (glade_dialog);
|
|
||||||
|
|
||||||
if (data->dialog_title)
|
if (data->dialog_title)
|
||||||
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
|
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
|
||||||
|
|
||||||
@ -98,6 +95,8 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
|
|||||||
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (builder);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
src/text.c
19
src/text.c
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <glade/glade.h>
|
|
||||||
#include "zenity.h"
|
#include "zenity.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@ -102,22 +101,23 @@ zenity_text_fill_entries_from_stdin (GtkTextBuffer *text_buffer)
|
|||||||
void
|
void
|
||||||
zenity_text (ZenityData *data, ZenityTextData *text_data)
|
zenity_text (ZenityData *data, ZenityTextData *text_data)
|
||||||
{
|
{
|
||||||
GladeXML *glade_dialog = NULL;
|
GtkBuilder *builder;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *text_view;
|
GObject *text_view;
|
||||||
GtkTextBuffer *text_buffer;
|
GtkTextBuffer *text_buffer;
|
||||||
|
|
||||||
zen_text_data = text_data;
|
zen_text_data = text_data;
|
||||||
glade_dialog = zenity_util_load_glade_file ("zenity_text_dialog");
|
builder = zenity_util_load_ui_file ("zenity_text_dialog",
|
||||||
|
"textbuffer1", NULL);
|
||||||
|
|
||||||
if (glade_dialog == NULL) {
|
if (builder == NULL) {
|
||||||
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glade_xml_signal_autoconnect (glade_dialog);
|
gtk_builder_connect_signals (builder, NULL);
|
||||||
|
|
||||||
dialog = glade_xml_get_widget (glade_dialog, "zenity_text_dialog");
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_text_dialog"));
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (dialog), "response",
|
g_signal_connect (G_OBJECT (dialog), "response",
|
||||||
G_CALLBACK (zenity_text_dialog_response), data);
|
G_CALLBACK (zenity_text_dialog_response), data);
|
||||||
@ -130,7 +130,7 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
|
|||||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
|
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
|
||||||
|
|
||||||
text_buffer = gtk_text_buffer_new (NULL);
|
text_buffer = gtk_text_buffer_new (NULL);
|
||||||
text_view = glade_xml_get_widget (glade_dialog, "zenity_text_view");
|
text_view = gtk_builder_get_object (builder, "zenity_text_view");
|
||||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), text_buffer);
|
gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), text_buffer);
|
||||||
gtk_text_view_set_editable (GTK_TEXT_VIEW(text_view), text_data->editable);
|
gtk_text_view_set_editable (GTK_TEXT_VIEW(text_view), text_data->editable);
|
||||||
|
|
||||||
@ -149,8 +149,7 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
|
|||||||
|
|
||||||
zenity_util_show_dialog (dialog);
|
zenity_util_show_dialog (dialog);
|
||||||
|
|
||||||
if (glade_dialog)
|
g_object_unref (builder);
|
||||||
g_object_unref (glade_dialog);
|
|
||||||
|
|
||||||
if(data->timeout_delay > 0) {
|
if(data->timeout_delay > 0) {
|
||||||
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, NULL);
|
||||||
|
34
src/tree.c
34
src/tree.c
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <glade/glade.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "zenity.h"
|
#include "zenity.h"
|
||||||
@ -34,7 +33,7 @@
|
|||||||
#define MAX_ELEMENTS_BEFORE_SCROLLING 5
|
#define MAX_ELEMENTS_BEFORE_SCROLLING 5
|
||||||
#define PRINT_HIDE_COLUMN_SEPARATOR ","
|
#define PRINT_HIDE_COLUMN_SEPARATOR ","
|
||||||
|
|
||||||
static GladeXML *glade_dialog;
|
static GtkBuilder *builder;
|
||||||
static GSList *selected;
|
static GSList *selected;
|
||||||
static gchar *separator;
|
static gchar *separator;
|
||||||
static gboolean print_all_columns = FALSE;
|
static gboolean print_all_columns = FALSE;
|
||||||
@ -168,7 +167,8 @@ zenity_tree_handle_stdin (GIOChannel *channel,
|
|||||||
GtkRequisition rectangle;
|
GtkRequisition rectangle;
|
||||||
|
|
||||||
gtk_widget_size_request (GTK_WIDGET (tree_view), &rectangle);
|
gtk_widget_size_request (GTK_WIDGET (tree_view), &rectangle);
|
||||||
scrolled_window = glade_xml_get_widget (glade_dialog, "zenity_tree_window");
|
scrolled_window = GTK_WIDGET (gtk_builder_get_object (builder,
|
||||||
|
"zenity_tree_window"));
|
||||||
gtk_widget_set_size_request (scrolled_window, -1, rectangle.height);
|
gtk_widget_set_size_request (scrolled_window, -1, rectangle.height);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
@ -245,7 +245,8 @@ zenity_tree_fill_entries (GtkTreeView *tree_view,
|
|||||||
GtkRequisition rectangle;
|
GtkRequisition rectangle;
|
||||||
|
|
||||||
gtk_widget_size_request (GTK_WIDGET (tree_view), &rectangle);
|
gtk_widget_size_request (GTK_WIDGET (tree_view), &rectangle);
|
||||||
scrolled_window = glade_xml_get_widget (glade_dialog, "zenity_tree_window");
|
scrolled_window = GTK_WIDGET (gtk_builder_get_object (builder,
|
||||||
|
"zenity_tree_window"));
|
||||||
gtk_widget_set_size_request (scrolled_window, -1, rectangle.height);
|
gtk_widget_set_size_request (scrolled_window, -1, rectangle.height);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
@ -281,8 +282,8 @@ void
|
|||||||
zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
|
zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *tree_view;
|
GObject *tree_view;
|
||||||
GtkWidget *text;
|
GObject *text;
|
||||||
GtkTreeViewColumn *column;
|
GtkTreeViewColumn *column;
|
||||||
GtkListStore *model;
|
GtkListStore *model;
|
||||||
GType *column_types;
|
GType *column_types;
|
||||||
@ -290,9 +291,9 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
|
|||||||
gboolean first_column = FALSE;
|
gboolean first_column = FALSE;
|
||||||
gint i, column_index, n_columns;
|
gint i, column_index, n_columns;
|
||||||
|
|
||||||
glade_dialog = zenity_util_load_glade_file ("zenity_tree_dialog");
|
builder = zenity_util_load_ui_file ("zenity_tree_dialog", NULL);
|
||||||
|
|
||||||
if (glade_dialog == NULL) {
|
if (builder == NULL) {
|
||||||
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -328,9 +329,9 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glade_xml_signal_autoconnect (glade_dialog);
|
gtk_builder_connect_signals (builder, NULL);
|
||||||
|
|
||||||
dialog = glade_xml_get_widget (glade_dialog, "zenity_tree_dialog");
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_tree_dialog"));
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (dialog), "response",
|
g_signal_connect (G_OBJECT (dialog), "response",
|
||||||
G_CALLBACK (zenity_tree_dialog_response), data);
|
G_CALLBACK (zenity_tree_dialog_response), data);
|
||||||
@ -338,7 +339,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
|
|||||||
if (data->dialog_title)
|
if (data->dialog_title)
|
||||||
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
|
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
|
||||||
|
|
||||||
text = glade_xml_get_widget (glade_dialog, "zenity_tree_text");
|
text = gtk_builder_get_object (builder, "zenity_tree_text");
|
||||||
|
|
||||||
if (tree_data->dialog_text)
|
if (tree_data->dialog_text)
|
||||||
gtk_label_set_markup (GTK_LABEL (text), g_strcompress (tree_data->dialog_text));
|
gtk_label_set_markup (GTK_LABEL (text), g_strcompress (tree_data->dialog_text));
|
||||||
@ -348,10 +349,10 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
|
|||||||
if (data->width > -1 || data->height > -1)
|
if (data->width > -1 || data->height > -1)
|
||||||
gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height);
|
gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height);
|
||||||
|
|
||||||
tree_view = glade_xml_get_widget (glade_dialog, "zenity_tree_view");
|
tree_view = gtk_builder_get_object (builder, "zenity_tree_view");
|
||||||
|
|
||||||
if (!(tree_data->radiobox || tree_data->checkbox))
|
if (!(tree_data->radiobox || tree_data->checkbox))
|
||||||
g_signal_connect (G_OBJECT (tree_view), "row-activated",
|
g_signal_connect (tree_view, "row-activated",
|
||||||
G_CALLBACK (zenity_tree_row_activated), data);
|
G_CALLBACK (zenity_tree_row_activated), data);
|
||||||
|
|
||||||
/* Create an empty list store */
|
/* Create an empty list store */
|
||||||
@ -500,8 +501,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
|
|||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
||||||
if (glade_dialog)
|
g_object_unref (builder);
|
||||||
g_object_unref (glade_dialog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -591,13 +591,13 @@ static void
|
|||||||
zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data)
|
zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data)
|
||||||
{
|
{
|
||||||
ZenityData *zen_data = data;
|
ZenityData *zen_data = data;
|
||||||
GtkWidget *tree_view;
|
GObject *tree_view;
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
|
|
||||||
switch (response) {
|
switch (response) {
|
||||||
case GTK_RESPONSE_OK:
|
case GTK_RESPONSE_OK:
|
||||||
tree_view = glade_xml_get_widget (glade_dialog, "zenity_tree_view");
|
tree_view = gtk_builder_get_object (builder, "zenity_tree_view");
|
||||||
model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view));
|
model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view));
|
||||||
|
|
||||||
if (gtk_tree_model_get_column_type (model, 0) == G_TYPE_BOOLEAN)
|
if (gtk_tree_model_get_column_type (model, 0) == G_TYPE_BOOLEAN)
|
||||||
|
62
src/util.c
62
src/util.c
@ -34,6 +34,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "zenity.h"
|
#include "zenity.h"
|
||||||
@ -48,27 +49,62 @@
|
|||||||
#define ZENITY_ERROR_DEFAULT -1
|
#define ZENITY_ERROR_DEFAULT -1
|
||||||
#define ZENITY_EXTRA_DEFAULT 127
|
#define ZENITY_EXTRA_DEFAULT 127
|
||||||
|
|
||||||
GladeXML*
|
GtkBuilder*
|
||||||
zenity_util_load_glade_file (const gchar *widget_root)
|
zenity_util_load_ui_file (const gchar *root_widget, ...)
|
||||||
{
|
{
|
||||||
GladeXML *xml = NULL;
|
va_list args;
|
||||||
|
gchar *arg = NULL;
|
||||||
|
GPtrArray *ptrarray;
|
||||||
|
GtkBuilder *builder = gtk_builder_new ();
|
||||||
|
GError *error = NULL;
|
||||||
|
gchar **objects;
|
||||||
|
guint result = 0;
|
||||||
|
|
||||||
if (g_file_test (ZENITY_GLADE_FILE_RELATIVEPATH, G_FILE_TEST_EXISTS)) {
|
gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
|
||||||
/* Try current dir, for debugging */
|
|
||||||
xml = glade_xml_new (ZENITY_GLADE_FILE_RELATIVEPATH, widget_root, GETTEXT_PACKAGE);
|
/* We have at least the root_widget and a NULL */
|
||||||
|
ptrarray = g_ptr_array_sized_new (2);
|
||||||
|
|
||||||
|
g_ptr_array_add (ptrarray, g_strdup (root_widget));
|
||||||
|
|
||||||
|
va_start (args, root_widget);
|
||||||
|
|
||||||
|
arg = va_arg (args, gchar*);
|
||||||
|
|
||||||
|
while (arg) {
|
||||||
|
g_ptr_array_add (ptrarray, g_strdup (arg));
|
||||||
|
arg = va_arg (args, gchar*);
|
||||||
}
|
}
|
||||||
|
va_end (args);
|
||||||
if (xml == NULL)
|
|
||||||
xml = glade_xml_new (ZENITY_GLADE_FILE_FULLPATH, widget_root, GETTEXT_PACKAGE);
|
|
||||||
|
|
||||||
if (xml == NULL) {
|
/* Enforce terminating NULL */
|
||||||
g_warning ("Could not load glade file : %s", ZENITY_GLADE_FILE_FULLPATH);
|
g_ptr_array_add (ptrarray, NULL);
|
||||||
|
objects = (gchar**) g_ptr_array_free (ptrarray, FALSE);
|
||||||
|
|
||||||
|
if (g_file_test (ZENITY_UI_FILE_RELATIVEPATH, G_FILE_TEST_EXISTS)) {
|
||||||
|
/* Try current dir, for debugging */
|
||||||
|
result = gtk_builder_add_objects_from_file (builder,
|
||||||
|
ZENITY_UI_FILE_RELATIVEPATH,
|
||||||
|
objects, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == 0)
|
||||||
|
result = gtk_builder_add_objects_from_file (builder,
|
||||||
|
ZENITY_UI_FILE_FULLPATH,
|
||||||
|
objects, &error);
|
||||||
|
|
||||||
|
g_strfreev (objects);
|
||||||
|
|
||||||
|
if (result == 0) {
|
||||||
|
g_warning ("Could not load ui file %s: %s", ZENITY_UI_FILE_FULLPATH,
|
||||||
|
error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
g_object_unref (builder);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return xml;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar*
|
gchar*
|
||||||
zenity_util_strip_newline (gchar *string)
|
zenity_util_strip_newline (gchar *string)
|
||||||
{
|
{
|
||||||
|
@ -2,16 +2,16 @@
|
|||||||
#define UTIL_H
|
#define UTIL_H
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glade/glade.h>
|
|
||||||
#include "zenity.h"
|
#include "zenity.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define ZENITY_GLADE_FILE_FULLPATH ZENITY_DATADIR "/zenity.glade"
|
#define ZENITY_UI_FILE_FULLPATH ZENITY_DATADIR "/zenity.ui"
|
||||||
#define ZENITY_GLADE_FILE_RELATIVEPATH "./zenity.glade"
|
#define ZENITY_UI_FILE_RELATIVEPATH "./zenity.ui"
|
||||||
|
|
||||||
#define ZENITY_IMAGE_FULLPATH(filename) (ZENITY_DATADIR "/" filename)
|
#define ZENITY_IMAGE_FULLPATH(filename) (ZENITY_DATADIR "/" filename)
|
||||||
|
|
||||||
GladeXML* zenity_util_load_glade_file (const gchar *widget_root);
|
GtkBuilder* zenity_util_load_ui_file (const gchar *widget_root, ...) G_GNUC_NULL_TERMINATED;
|
||||||
gchar * zenity_util_strip_newline (gchar *string);
|
gchar * zenity_util_strip_newline (gchar *string);
|
||||||
gboolean zenity_util_fill_file_buffer (GtkTextBuffer *buffer,
|
gboolean zenity_util_fill_file_buffer (GtkTextBuffer *buffer,
|
||||||
const gchar *filename);
|
const gchar *filename);
|
||||||
|
1854
src/zenity.ui
Normal file
1854
src/zenity.ui
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user