Merge branch 'jjardon/no_deprecated'

Conflicts:
	src/msg.c
This commit is contained in:
Arx Cruz 2015-04-21 13:51:23 +02:00
commit a0fa643f1c
15 changed files with 161 additions and 353 deletions

View File

@ -103,15 +103,11 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
if (data->ok_label) {
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_calendar_ok_button"));
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
}
if (data->cancel_label) {
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_calendar_cancel_button"));
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
}
g_object_unref (builder);

View File

@ -34,27 +34,21 @@ static void zenity_colorselection_dialog_response (GtkWidget *widget, int respon
void zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
{
GtkWidget *dialog;
GtkWidget *colorsel;
GtkWidget *button;
GdkColor color;
GdkRGBA color;
zen_data = data;
dialog = gtk_color_selection_dialog_new (NULL);
dialog = gtk_color_chooser_dialog_new (data->dialog_title, NULL);
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (zenity_colorselection_dialog_response),
color_data);
if (data->dialog_title)
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
colorsel = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (dialog));
if (color_data->color) {
if (gdk_color_parse (color_data->color, &color))
gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (colorsel),
&color);
if (gdk_rgba_parse (&color, color_data->color)) {
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog), &color);
}
}
if (data->extra_label) {
@ -68,24 +62,19 @@ void zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
if (data->ok_label) {
g_object_get (G_OBJECT (dialog), "ok-button", &button, NULL);
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
g_object_unref (G_OBJECT (button));
}
if (data->cancel_label) {
g_object_get (G_OBJECT (dialog), "cancel-button", &button, NULL);
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
g_object_unref (G_OBJECT (button));
}
if (data->modal)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION (colorsel),
color_data->show_palette);
g_object_set (dialog, "show-editor", !color_data->show_palette, NULL);
zenity_util_show_dialog (dialog, data->attach);
@ -101,15 +90,13 @@ void zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
static void
zenity_colorselection_dialog_response (GtkWidget *widget, int response, gpointer data)
{
GtkWidget *colorsel;
GdkColor color;
GdkRGBA color;
switch (response) {
case GTK_RESPONSE_OK:
zenity_util_exit_code_with_data(ZENITY_OK, zen_data);
colorsel = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (widget));
gtk_color_selection_get_current_color (GTK_COLOR_SELECTION (colorsel), &color);
g_print ("%s\n", gdk_color_to_string (&color));
zenity_util_exit_code_with_data(ZENITY_OK, zen_data);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &color);
g_print ("%s\n", gdk_rgba_to_string (&color));
break;
case GTK_RESPONSE_CANCEL:

View File

@ -95,15 +95,11 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
if (data->ok_label) {
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_entry_ok_button"));
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
}
if (data->cancel_label) {
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_entry_cancel_button"));
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
}
text = gtk_builder_get_object (builder, "zenity_entry_text");

View File

@ -52,8 +52,8 @@ void zenity_fileselection (ZenityData *data, ZenityFileData *file_data)
dialog = gtk_file_chooser_dialog_new (NULL, NULL,
action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_OK"), GTK_RESPONSE_OK,
NULL);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),

View File

@ -173,13 +173,12 @@ void zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data)
{
GtkBuilder *builder = NULL;
GtkWidget *dialog;
GtkWidget *table;
GtkWidget *grid;
GtkWidget *text;
GtkWidget *button;
GSList *tmp;
gint number_of_widgets = g_slist_length (forms_data->list);
int list_count = 0;
int combo_count = 0;
int i = 0;
@ -217,15 +216,11 @@ void zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data)
if (data->ok_label) {
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_ok_button"));
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
}
if (data->cancel_label) {
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_cancel_button"));
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
}
text = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_text"));
@ -233,122 +228,51 @@ void zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data)
if (forms_data->dialog_text)
gtk_label_set_markup (GTK_LABEL (text), g_strcompress (forms_data->dialog_text));
table = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_table"));
gtk_table_resize (GTK_TABLE (table), number_of_widgets, 2);
grid = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_grid"));
for (tmp = forms_data->list; tmp; tmp = tmp->next) {
ZenityFormsValue *zenity_value = (ZenityFormsValue *) tmp->data;
GtkWidget *label;
GtkWidget *align;
label = gtk_label_new(zenity_value->option_value);
align = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (align), label);
gtk_table_attach (GTK_TABLE (table),
GTK_WIDGET (align),
0,
1,
i,
i+1,
GTK_FILL,
GTK_FILL,
0,
0);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_grid_attach (GTK_GRID (grid),
label,
0, i,
1, 1);
switch(zenity_value->type)
{
case ZENITY_FORMS_ENTRY:
zenity_value->forms_widget = gtk_entry_new();
gtk_table_attach (GTK_TABLE (table),
GTK_WIDGET (zenity_value->forms_widget),
1,
2,
i,
i+1,
GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
0,
0);
break;
case ZENITY_FORMS_PASSWORD:
zenity_value->forms_widget = gtk_entry_new();
gtk_entry_set_visibility(GTK_ENTRY(zenity_value->forms_widget),
FALSE);
gtk_table_attach (GTK_TABLE (table),
GTK_WIDGET (zenity_value->forms_widget),
1,
2,
i,
i+1,
GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
0,
0);
break;
case ZENITY_FORMS_CALENDAR:
zenity_value->forms_widget = gtk_calendar_new();
gtk_alignment_set (GTK_ALIGNMENT (align), 0.0, 0.02, 0.0, 0.0);
align = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (align), zenity_value->forms_widget);
gtk_table_attach (GTK_TABLE (table),
GTK_WIDGET (align),
1,
2,
i,
i+1,
GTK_FILL,
GTK_FILL,
0,
0);
break;
case ZENITY_FORMS_LIST:
zenity_value->forms_widget = zenity_forms_create_and_fill_list (forms_data, list_count,
zenity_value->option_value);
gtk_alignment_set (GTK_ALIGNMENT (align), 0.0, 0.02, 0.0, 0.0);
gtk_table_attach (GTK_TABLE (table),
GTK_WIDGET (zenity_value->forms_widget),
1,
2,
i,
i+1,
GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
0,
0);
list_count++;
break;
case ZENITY_FORMS_COMBO:
zenity_value->forms_widget = zenity_forms_create_and_fill_combo (forms_data, combo_count);
gtk_alignment_set (GTK_ALIGNMENT (align), 0.0, 0.02, 0.0, 0.0);
gtk_table_attach (GTK_TABLE (table),
GTK_WIDGET (zenity_value->forms_widget),
1,
2,
i,
i+1,
GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
0,
0);
combo_count++;
break;
default:
zenity_value->forms_widget = gtk_entry_new();
gtk_table_attach (GTK_TABLE (table),
GTK_WIDGET (zenity_value->forms_widget),
1,
2,
i,
i+1,
GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
0,
0);
break;
}
gtk_grid_attach_next_to (GTK_GRID (grid),
GTK_WIDGET (zenity_value->forms_widget),
label,
GTK_POS_RIGHT,
1, 1);
i++;
}

View File

@ -34,22 +34,18 @@ zenity_msg_construct_question_dialog (GtkWidget *dialog, ZenityMsgData *msg_data
GtkWidget *cancel_button, *ok_button;
cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_NO, GTK_RESPONSE_CANCEL);
ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_YES, GTK_RESPONSE_OK);
cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_No"), GTK_RESPONSE_CANCEL);
ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Yes"), GTK_RESPONSE_OK);
gtk_widget_grab_focus (msg_data->default_cancel ? cancel_button : ok_button);
if (data->cancel_label) {
gtk_button_set_label (GTK_BUTTON (cancel_button), data->cancel_label);
gtk_button_set_image (GTK_BUTTON (cancel_button),
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
}
if (data->ok_label) {
gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
gtk_button_set_image (GTK_BUTTON (ok_button),
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
}
@ -157,31 +153,29 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
if (ok_button) {
if (data->ok_label) {
gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
gtk_button_set_image (GTK_BUTTON (ok_button),
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
}
}
switch (msg_data->mode) {
case ZENITY_MSG_WARNING:
zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_WARNING);
zenity_util_set_window_icon_from_icon_name (dialog, data->window_icon, "dialog-warning");
break;
case ZENITY_MSG_QUESTION:
zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_QUESTION);
zenity_util_set_window_icon_from_icon_name (dialog, data->window_icon, "dialog-question");
zenity_msg_construct_question_dialog (dialog, msg_data, data);
break;
case ZENITY_MSG_SWITCH:
zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_QUESTION);
zenity_util_set_window_icon_from_icon_name (dialog, data->window_icon, "dialog-question");
break;
case ZENITY_MSG_ERROR:
zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_ERROR);
zenity_util_set_window_icon_from_icon_name (dialog, data->window_icon, "dialog-error");
break;
case ZENITY_MSG_INFO:
zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_INFO);
zenity_util_set_window_icon_from_icon_name (dialog, data->window_icon, "dialog-information");
break;
default:

View File

@ -175,10 +175,6 @@ zenity_notification_handle_stdin (GIOChannel *channel,
GIOCondition condition,
gpointer user_data)
{
ZenityData *zen_data;
zen_data = (ZenityData *)user_data;
if ((condition & G_IO_IN) != 0) {
GString *string;
GError *error = NULL;

View File

@ -38,7 +38,6 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data
GtkWidget *vbox_labels;
GtkWidget *vbox_entries;
GtkWidget *label;
GtkWidget *align;
zen_data = data;
@ -53,17 +52,17 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data
}
gtk_dialog_add_button(GTK_DIALOG(dialog),
data->cancel_label != NULL ? data->cancel_label : GTK_STOCK_CANCEL,
data->cancel_label != NULL ? data->cancel_label : _("_Cancel"),
GTK_RESPONSE_CANCEL);
gtk_dialog_add_button(GTK_DIALOG(dialog),
data->ok_label != NULL ? data->ok_label : GTK_STOCK_OK,
data->ok_label != NULL ? data->ok_label : _("_OK"),
GTK_RESPONSE_OK);
image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION,
GTK_ICON_SIZE_DIALOG);
image = gtk_image_new_from_icon_name("dialog-password",
GTK_ICON_SIZE_DIALOG);
gtk_dialog_set_default_response(GTK_DIALOG(dialog),
GTK_RESPONSE_OK);
hbox = gtk_hbox_new(FALSE, 5);
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_pack_start(GTK_BOX(hbox),
image,
FALSE,
@ -89,10 +88,10 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data
TRUE,
5);
vbox_labels = gtk_vbox_new(FALSE, 5);
vbox_entries = gtk_vbox_new(FALSE, 5);
vbox_labels = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
vbox_entries = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
hbox = gtk_hbox_new(FALSE, 5);
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
hbox,
FALSE,
@ -111,11 +110,9 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data
12);
if(password_data->username) {
align = gtk_alignment_new(0.0, 0.12, 0.0, 0.0);
label = gtk_label_new(_("Username:"));
gtk_container_add(GTK_CONTAINER(align), label);
gtk_box_pack_start(GTK_BOX(vbox_labels),
align,
label,
TRUE,
FALSE,
12);
@ -127,12 +124,9 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data
12);
}
align = gtk_alignment_new(0.0, 0.5, 0.0, 0.0);
label = gtk_label_new(_("Password:"));
gtk_container_add(GTK_CONTAINER(align), label);
gtk_box_pack_start(GTK_BOX(vbox_labels),
align,
label,
TRUE,
FALSE,
12);

View File

@ -327,15 +327,11 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
if (data->ok_label) {
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_progress_ok_button"));
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
}
if (data->cancel_label) {
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_progress_cancel_button"));
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
}
if (progress_data->dialog_text)

View File

@ -90,15 +90,11 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
if (data->ok_label) {
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_scale_ok_button"));
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
}
if (data->cancel_label) {
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_scale_cancel_button"));
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
}
if (scale_data->dialog_text)

View File

@ -265,7 +265,7 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
if (text_data->font) {
PangoFontDescription *fontDesc = pango_font_description_from_string (text_data->font);
gtk_widget_modify_font (GTK_WIDGET(text_view), fontDesc);
gtk_widget_override_font (GTK_WIDGET(text_view), fontDesc);
}
if (text_data->uri)
@ -286,14 +286,10 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
if (data->ok_label) {
gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
gtk_button_set_image (GTK_BUTTON (ok_button),
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
}
if (data->cancel_label) {
gtk_button_set_label (GTK_BUTTON (cancel_button), data->cancel_label);
gtk_button_set_image (GTK_BUTTON (cancel_button),
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
}
if (text_data->checkbox) {

View File

@ -305,8 +305,9 @@ zenity_mid_search_func (GtkTreeModel *model, gint column,
{
gchar *iter_string = NULL;
gtk_tree_model_get (model, iter, column, &iter_string, -1);
return ! g_strrstr (g_utf8_strdown(iter_string, -1),
g_utf8_strdown(key, -1)) != NULL;
return ! (g_strrstr (g_utf8_strdown(iter_string, -1),
g_utf8_strdown(key, -1)) != NULL);
}
static void
@ -407,15 +408,11 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
if (data->ok_label) {
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_tree_ok_button"));
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
}
if (data->cancel_label) {
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_tree_cancel_button"));
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
}
text = gtk_builder_get_object (builder, "zenity_tree_text");
@ -563,8 +560,6 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
column_index++;
}
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree_view), TRUE);
if (tree_data->hide_header)
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);

View File

@ -178,32 +178,36 @@ zenity_util_fill_file_buffer (GtkTextBuffer *buffer, const gchar *filename)
}
const gchar *
zenity_util_stock_from_filename (const gchar *filename)
zenity_util_icon_name_from_filename (const gchar *filename)
{
if (!filename || !filename[0])
return GTK_STOCK_DIALOG_WARNING; /* default */
return "dialog-warning"; /* default */
if (!g_ascii_strcasecmp (filename, "warning"))
return GTK_STOCK_DIALOG_WARNING;
return "dialog-warning";
if (!g_ascii_strcasecmp (filename, "info"))
return GTK_STOCK_DIALOG_INFO;
return "dialog-information";
if (!g_ascii_strcasecmp (filename, "question"))
return GTK_STOCK_DIALOG_QUESTION;
return "dialog-question";
if (!g_ascii_strcasecmp (filename, "error"))
return GTK_STOCK_DIALOG_ERROR;
return "dialog-error";
return NULL;
}
GdkPixbuf *
zenity_util_pixbuf_new_from_file (GtkWidget *widget, const gchar *filename)
void
zenity_util_set_window_icon_from_file (GtkWidget *widget, const gchar *filename)
{
const gchar *stock;
GdkPixbuf *pixbuf;
const gchar *icon_name;
stock = zenity_util_stock_from_filename (filename);
if (stock)
return gtk_widget_render_icon (widget, stock, GTK_ICON_SIZE_BUTTON, NULL);
return gdk_pixbuf_new_from_file (filename, NULL);
icon_name = zenity_util_icon_name_from_filename (filename);
if (icon_name) {
gtk_window_set_icon_name (GTK_WINDOW (widget), icon_name);
} else {
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
gtk_window_set_icon (GTK_WINDOW (widget), pixbuf);
g_object_unref (pixbuf);
}
}
void
@ -211,33 +215,24 @@ zenity_util_set_window_icon (GtkWidget *widget, const gchar *filename, const gch
{
GdkPixbuf *pixbuf;
if (filename != NULL)
pixbuf = zenity_util_pixbuf_new_from_file (widget, (gchar *) filename);
else
pixbuf = gdk_pixbuf_new_from_file (default_file, NULL);
if (pixbuf != NULL) {
gtk_window_set_icon (GTK_WINDOW (widget), pixbuf);
g_object_unref (pixbuf);
if (filename != NULL) {
zenity_util_set_window_icon_from_file (widget, filename);
} else {
pixbuf = gdk_pixbuf_new_from_file (default_file, NULL);
if (pixbuf != NULL) {
gtk_window_set_icon (GTK_WINDOW (widget), pixbuf);
g_object_unref (pixbuf);
}
}
}
void
zenity_util_set_window_icon_from_stock (GtkWidget *widget, const gchar *filename, const gchar *default_stock_id)
void
zenity_util_set_window_icon_from_icon_name (GtkWidget *widget, const gchar *filename, const gchar *default_icon_name)
{
GdkPixbuf *pixbuf;
if (filename != NULL) {
pixbuf = zenity_util_pixbuf_new_from_file (widget, (gchar *) filename);
}
else {
pixbuf = gtk_widget_render_icon (widget, default_stock_id, GTK_ICON_SIZE_BUTTON, NULL);
}
if (pixbuf != NULL) {
gtk_window_set_icon (GTK_WINDOW (widget), pixbuf);
g_object_unref (pixbuf);
}
if (filename != NULL)
zenity_util_set_window_icon_from_file (widget, filename);
else
gtk_window_set_icon_name (GTK_WINDOW (widget), default_icon_name);
}
void

View File

@ -21,14 +21,14 @@ GtkBuilder* zenity_util_load_ui_file (const gchar *widge
gchar * zenity_util_strip_newline (gchar *string);
gboolean zenity_util_fill_file_buffer (GtkTextBuffer *buffer,
const gchar *filename);
const gchar * zenity_util_stock_from_filename (const gchar *filename);
const gchar * zenity_util_icon_name_from_filename (const gchar *filename);
void zenity_util_set_window_icon (GtkWidget *widget,
const gchar *filename,
const gchar *default_file);
void zenity_util_set_window_icon_from_stock (GtkWidget *widget,
void zenity_util_set_window_icon_from_icon_name(GtkWidget *widget,
const gchar *filename,
const gchar *default_stock_id);
GdkPixbuf * zenity_util_pixbuf_new_from_file (GtkWidget *widget,
const gchar *default_icon_name);
void zenity_util_set_window_icon_from_file (GtkWidget *widget,
const gchar *filename);
void zenity_util_show_help (GError **error);
gint zenity_util_return_exit_code (ZenityExitCode value);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<requires lib="gtk+" version="3.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step_increment">1</property>
@ -17,22 +17,21 @@
<property name="type_hint">dialog</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox11">
<object class="GtkBox" id="dialog-vbox11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area11">
<object class="GtkButtonBox" id="dialog-action_area11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="zenity_scale_cancel_button">
<property name="label">gtk-cancel</property>
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -42,12 +41,11 @@
</child>
<child>
<object class="GtkButton" id="zenity_scale_ok_button">
<property name="label">gtk-ok</property>
<property name="label" translatable="yes">OK</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -64,10 +62,11 @@
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox13">
<object class="GtkBox" id="vbox13">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="zenity_scale_text">
@ -84,7 +83,7 @@
</packing>
</child>
<child>
<object class="GtkHScale" id="zenity_scale_hscale">
<object class="GtkScale" id="zenity_scale_hscale">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment1</property>
@ -122,22 +121,21 @@
<property name="type_hint">dialog</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox5">
<object class="GtkBox" id="dialog-vbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area5">
<object class="GtkButtonBox" id="dialog-action_area5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="zenity_text_cancel_button">
<property name="label">gtk-cancel</property>
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -147,12 +145,11 @@
</child>
<child>
<object class="GtkButton" id="zenity_text_close_button">
<property name="label">gtk-ok</property>
<property name="label" translatable="yes">OK</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="image_position">right</property>
</object>
<packing>
@ -170,7 +167,7 @@
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox5">
<object class="GtkBox" id="vbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
@ -234,23 +231,22 @@
<property name="type_hint">dialog</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox2">
<object class="GtkBox" id="dialog-vbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area2">
<object class="GtkButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="zenity_calendar_cancel_button">
<property name="label">gtk-cancel</property>
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -260,13 +256,12 @@
</child>
<child>
<object class="GtkButton" id="zenity_calendar_ok_button">
<property name="label">gtk-ok</property>
<property name="label" translatable="yes">OK</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -283,13 +278,14 @@
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox1">
<object class="GtkBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkVBox" id="vbox2">
<object class="GtkBox" id="vbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
@ -365,23 +361,22 @@
<property name="type_hint">dialog</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox4">
<object class="GtkBox" id="dialog-vbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area4">
<object class="GtkButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="zenity_entry_cancel_button">
<property name="label">gtk-cancel</property>
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -391,13 +386,12 @@
</child>
<child>
<object class="GtkButton" id="zenity_entry_ok_button">
<property name="label">gtk-ok</property>
<property name="label" translatable="yes">OK</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -414,12 +408,13 @@
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox3">
<object class="GtkBox" id="vbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkVBox" id="vbox4">
<object class="GtkBox" id="vbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
@ -469,23 +464,22 @@
<property name="type_hint">dialog</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox7">
<object class="GtkBox" id="dialog-vbox7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">14</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area7">
<object class="GtkButtonBox" id="dialog-action_area7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="zenity_error_ok_button">
<property name="label">gtk-ok</property>
<property name="label" translatable="yes">OK</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -502,12 +496,12 @@
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox8">
<object class="GtkBox" id="vbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<child>
<object class="GtkHBox" id="hbox3">
<object class="GtkBox" id="hbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
@ -517,8 +511,8 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="yalign">0</property>
<property name="stock">gtk-dialog-error</property>
<property name="icon-size">6</property>
<property name="icon_name">dialog-error</property>
<property name="icon_size">6</property>
</object>
<packing>
<property name="expand">True</property>
@ -566,22 +560,21 @@
<property name="border_width">5</property>
<property name="type_hint">normal</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox12">
<object class="GtkBox" id="dialog-vbox12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area12">
<object class="GtkButtonBox" id="dialog-action_area12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="zenity_forms_cancel_button">
<property name="label">gtk-cancel</property>
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -591,11 +584,10 @@
</child>
<child>
<object class="GtkButton" id="zenity_forms_ok_button">
<property name="label">gtk-ok</property>
<property name="label" translatable="yes">OK</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -617,63 +609,15 @@
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<child>
<object class="GtkAlignment" id="alignment1">
<object class="GtkGrid" id="zenity_forms_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">12</property>
<property name="left_padding">12</property>
<property name="right_padding">6</property>
<child>
<object class="GtkTable" id="zenity_forms_table">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_columns">2</property>
<property name="column_spacing">10</property>
<property name="row_spacing">6</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<property name="margin_left">12</property>
<property name="margin_right">6</property>
<property name="margin_top">12</property>
<property name="margin_bottom">6</property>
<property name="row_spacing">6</property>
<property name="column_spacing">10</property>
</object>
</child>
<child type="label">
@ -708,23 +652,22 @@
<property name="type_hint">dialog</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox9">
<object class="GtkBox" id="dialog-vbox9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">14</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area3">
<object class="GtkButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="zenity_info_ok_button">
<property name="label">gtk-ok</property>
<property name="label" translatable="yes">OK</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -741,7 +684,7 @@
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox4">
<object class="GtkBox" id="hbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
@ -751,8 +694,8 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="yalign">0</property>
<property name="stock">gtk-dialog-info</property>
<property name="icon-size">6</property>
<property name="icon_name">dialog-information</property>
<property name="icon_size">6</property>
</object>
<packing>
<property name="expand">True</property>
@ -796,23 +739,22 @@
<property name="type_hint">dialog</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox6">
<object class="GtkBox" id="dialog-vbox6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area6">
<object class="GtkButtonBox" id="dialog-action_area6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="zenity_progress_cancel_button">
<property name="label">gtk-cancel</property>
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -822,14 +764,13 @@
</child>
<child>
<object class="GtkButton" id="zenity_progress_ok_button">
<property name="label">gtk-ok</property>
<property name="label" translatable="yes">OK</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -846,10 +787,11 @@
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox7">
<object class="GtkBox" id="vbox7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="zenity_progress_text">
@ -911,12 +853,12 @@
<property name="type_hint">dialog</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox3">
<object class="GtkBox" id="dialog-vbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">14</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="zenity_question_button_box">
<object class="GtkButtonBox" id="zenity_question_button_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@ -929,7 +871,7 @@
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<object class="GtkBox" id="hbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
@ -940,8 +882,8 @@
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="stock">gtk-dialog-question</property>
<property name="icon-size">6</property>
<property name="icon_name">dialog-question</property>
<property name="icon_size">6</property>
</object>
<packing>
<property name="expand">False</property>
@ -984,22 +926,21 @@
<property name="type_hint">dialog</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox8">
<object class="GtkBox" id="dialog-vbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area8">
<object class="GtkButtonBox" id="dialog-action_area8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="zenity_tree_cancel_button">
<property name="label">gtk-cancel</property>
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -1009,12 +950,11 @@
</child>
<child>
<object class="GtkButton" id="zenity_tree_ok_button">
<property name="label">gtk-ok</property>
<property name="label" translatable="yes">OK</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -1031,10 +971,11 @@
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox10">
<object class="GtkBox" id="vbox10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="zenity_tree_text">
@ -1059,6 +1000,9 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</object>
</child>
</object>
@ -1090,24 +1034,23 @@
<property name="type_hint">dialog</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">14</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="zenity_warning_ok_button">
<property name="label">gtk-ok</property>
<property name="label" translatable="yes">OK</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -1124,7 +1067,7 @@
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox2">
<object class="GtkBox" id="hbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
@ -1135,8 +1078,8 @@
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="stock">gtk-dialog-warning</property>
<property name="icon-size">6</property>
<property name="icon_name">dialog-warning</property>
<property name="icon_size">6</property>
</object>
<packing>
<property name="expand">False</property>