diff --git a/data/geany.glade b/data/geany.glade index c6884f5f0..348db3b98 100644 --- a/data/geany.glade +++ b/data/geany.glade @@ -7251,6 +7251,611 @@ okbutton1 + + False + 5 + 300 + dialog + window1 + + + + + True + False + 2 + + + True + False + end + + + gtk-close + True + True + True + True + + + False + False + 1 + + + + + False + True + end + 0 + + + + + True + False + 6 + 12 + + + True + False + 6 + + + True + False + 1 + gtk-file + + + True + True + 0 + + + + + True + False + 0 + file name + True + + + + + + True + True + 1 + + + + + True + False + 0 + + + + + True + False + 8 + 2 + 10 + 10 + + + True + False + 1 + Type: + + + + + + + + True + False + 0 + file type + True + + + 1 + 2 + + + + + True + False + 1 + Size: + + + + + + 1 + 2 + + + + + True + False + 1 + Location: + + + + + + 2 + 3 + + + + + True + False + 1 + Read-only: + + + + + + 3 + 4 + + + + + True + False + 1 + Encoding: + + + + + + 4 + 5 + + + + + True + False + 1 + Modified: + + + + + + 5 + 6 + + + + + True + False + 1 + Changed: + + + + + + 6 + 7 + + + + + True + False + 1 + Accessed: + + + + + + 7 + 8 + + + + + True + False + 0 + file size + True + + + 1 + 2 + 1 + 2 + + + + + True + False + 0 + file path + True + + + 1 + 2 + 2 + 3 + + + + + (only inside Geany) + True + False + False + False + False + 0 + True + + + 1 + 2 + 3 + 4 + + + + + True + False + 0 + file encoding + True + + + 1 + 2 + 4 + 5 + + + + + True + False + 0 + file mdate + True + + + 1 + 2 + 5 + 6 + + + + + True + False + 0 + file cdate + True + + + 1 + 2 + 6 + 7 + + + + + True + False + 0 + file adate + True + + + 1 + 2 + 7 + 8 + + + + + True + False + 1 + + + + + True + False + 5 + 4 + 5 + 5 + True + + + True + False + 0 + Permissions: + + + + + + 4 + + + + + True + False + 0 + Read: + + + 1 + 2 + 1 + 2 + + + + + True + False + 0 + Write: + + + 2 + 3 + 1 + 2 + + + + + True + False + 0 + Execute: + + + 3 + 4 + 1 + 2 + + + + + True + False + 1 + Owner: + + + 2 + 3 + + + + + True + False + 1 + Group: + + + 3 + 4 + + + + + True + False + 1 + Other: + + + 4 + 5 + + + + + True + False + True + False + False + True + + + 1 + 2 + 2 + 3 + + + + + True + False + True + False + False + True + + + 2 + 3 + 2 + 3 + + + + + True + False + True + False + False + True + + + 3 + 4 + 2 + 3 + + + + + True + False + True + False + False + True + + + 1 + 2 + 3 + 4 + + + + + True + False + True + False + False + True + + + 2 + 3 + 3 + 4 + + + + + True + False + True + False + False + True + + + 3 + 4 + 3 + 4 + + + + + True + False + True + False + False + True + + + 1 + 2 + 4 + 5 + + + + + True + False + True + False + False + True + + + 2 + 3 + 4 + 5 + + + + + True + False + True + False + False + True + + + 3 + 4 + 4 + 5 + + + + + True + False + 2 + + + + + True + True + 1 + + + + + + button1 + + diff --git a/src/dialogs.c b/src/dialogs.c index aaacf1429..3c0613a8a 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -1143,7 +1143,7 @@ gboolean dialogs_show_input_numeric(const gchar *title, const gchar *label_text, void dialogs_show_file_properties(GeanyDocument *doc) { - GtkWidget *dialog, *label, *table, *hbox, *image, *perm_table, *check, *vbox; + GtkWidget *dialog, *label, *image, *check; gchar *file_size, *title, *base_name, *time_changed, *time_modified, *time_accessed, *enctext; gchar *short_name; GdkPixbuf *pixbuf; @@ -1210,311 +1210,75 @@ void dialogs_show_file_properties(GeanyDocument *doc) base_name = g_path_get_basename(doc->file_name); short_name = utils_str_middle_truncate(base_name, 30); title = g_strdup_printf(_("%s Properties"), short_name); - dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(main_widgets.window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL, NULL); + dialog = ui_builder_get_object("properties_dialog"); + gtk_window_set_title(GTK_WINDOW(dialog), title); g_free(short_name); g_free(title); gtk_widget_set_name(dialog, "GeanyDialog"); - vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog)); - g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_destroy), NULL); + label = ui_lookup_widget(dialog, "file_name_label"); + gtk_label_set_text(GTK_LABEL(label), base_name); - gtk_window_set_default_size(GTK_WINDOW(dialog), 300, -1); - - label = ui_label_new_bold(base_name); - gtk_label_set_selectable(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + image = ui_lookup_widget(dialog, "file_type_image"); pixbuf = ui_get_mime_icon(doc->file_type->mime_type, GTK_ICON_SIZE_BUTTON); - image = gtk_image_new_from_pixbuf(pixbuf); + gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf); g_object_unref(pixbuf); - gtk_misc_set_alignment(GTK_MISC(image), 1.0, 0.5); - hbox = gtk_hbox_new(FALSE, 6); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_box_pack_start(GTK_BOX(hbox), image, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); - table = gtk_table_new(8, 2, FALSE); - gtk_table_set_row_spacings(GTK_TABLE(table), 10); - gtk_table_set_col_spacings(GTK_TABLE(table), 10); - - label = gtk_label_new(_("Type:")); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0); - - label = gtk_label_new(doc->file_type->title); - gtk_label_set_selectable(GTK_LABEL(label), TRUE); - gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - - label = gtk_label_new(_("Size:")); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0); + label = ui_lookup_widget(dialog, "file_type_label"); + gtk_label_set_text(GTK_LABEL(label), doc->file_type->title); + label = ui_lookup_widget(dialog, "file_size_label"); file_size = utils_make_human_readable_str(filesize, 1, 0); - label = gtk_label_new(file_size); - gtk_label_set_selectable(GTK_LABEL(label), TRUE); - gtk_table_attach(GTK_TABLE(table), label, 1, 2, 1, 2, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); + gtk_label_set_text(GTK_LABEL(label), file_size); g_free(file_size); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - label = gtk_label_new(_("Location:")); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0); + label = ui_lookup_widget(dialog, "file_location_label"); + gtk_label_set_text(GTK_LABEL(label), doc->file_name); - label = gtk_label_new(doc->file_name); - gtk_label_set_selectable(GTK_LABEL(label), TRUE); - gtk_table_attach(GTK_TABLE(table), label, 1, 2, 2, 3, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0); - - label = gtk_label_new(_("Read-only:")); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0); - - check = gtk_check_button_new_with_label(_("(only inside Geany)")); - gtk_widget_set_sensitive(check, FALSE); - gtk_button_set_focus_on_click(GTK_BUTTON(check), FALSE); + check = ui_lookup_widget(dialog, "file_read_only_check"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), doc->readonly); - gtk_table_attach(GTK_TABLE(table), check, 1, 2, 3, 4, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_button_set_alignment(GTK_BUTTON(check), 0.0, 0); - - label = gtk_label_new(_("Encoding:")); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0); + label = ui_lookup_widget(dialog, "file_encoding_label"); enctext = g_strdup_printf("%s %s", doc->encoding, (encodings_is_unicode_charset(doc->encoding)) ? ((doc->has_bom) ? _("(with BOM)") : _("(without BOM)")) : ""); - - label = gtk_label_new(enctext); - gtk_label_set_selectable(GTK_LABEL(label), TRUE); + gtk_label_set_text(GTK_LABEL(label), enctext); g_free(enctext); - gtk_table_attach(GTK_TABLE(table), label, 1, 2, 4, 5, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0); + label = ui_lookup_widget(dialog, "file_modified_label"); + gtk_label_set_text(GTK_LABEL(label), time_modified); + label = ui_lookup_widget(dialog, "file_changed_label"); + gtk_label_set_text(GTK_LABEL(label), time_changed); + label = ui_lookup_widget(dialog, "file_accessed_label"); + gtk_label_set_text(GTK_LABEL(label), time_accessed); - label = gtk_label_new(_("Modified:")); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0); - - label = gtk_label_new(time_modified); - gtk_label_set_selectable(GTK_LABEL(label), TRUE); - gtk_table_attach(GTK_TABLE(table), label, 1, 2, 5, 6, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - - label = gtk_label_new(_("Changed:")); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 6, 7, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0); - - label = gtk_label_new(time_changed); - gtk_label_set_selectable(GTK_LABEL(label), TRUE); - gtk_table_attach(GTK_TABLE(table), label, 1, 2, 6, 7, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - - label = gtk_label_new(_("Accessed:")); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 7, 8, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0); - - label = gtk_label_new(time_accessed); - gtk_label_set_selectable(GTK_LABEL(label), TRUE); - gtk_table_attach(GTK_TABLE(table), label, 1, 2, 7, 8, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - - /* add table */ - gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0); - - /* create table with the permissions */ - perm_table = gtk_table_new(5, 4, TRUE); - gtk_table_set_row_spacings(GTK_TABLE(perm_table), 5); - gtk_table_set_col_spacings(GTK_TABLE(perm_table), 5); - - label = gtk_label_new(_("Permissions:")); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - gtk_table_attach(GTK_TABLE(perm_table), label, 0, 4, 0, 1, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - - /* Header */ - label = gtk_label_new(_("Read:")); - gtk_table_attach(GTK_TABLE(perm_table), label, 1, 2, 1, 2, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0); - - label = gtk_label_new(_("Write:")); - gtk_table_attach(GTK_TABLE(perm_table), label, 2, 3, 1, 2, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0); - - label = gtk_label_new(_("Execute:")); - gtk_table_attach(GTK_TABLE(perm_table), label, 3, 4, 1, 2, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0); - - /* Owner */ - label = gtk_label_new(_("Owner:")); - gtk_table_attach(GTK_TABLE(perm_table), label, 0, 1, 2, 3, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0); - - check = gtk_check_button_new(); - gtk_widget_set_sensitive(check, FALSE); - gtk_button_set_focus_on_click(GTK_BUTTON(check), FALSE); + /* permissions */ + check = ui_lookup_widget(dialog, "file_perm_owner_r_check"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), mode & S_IRUSR); - gtk_table_attach(GTK_TABLE(perm_table), check, 1, 2, 2, 3, - (GtkAttachOptions) (GTK_EXPAND | GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_button_set_alignment(GTK_BUTTON(check), 0.5, 0); - - check = gtk_check_button_new(); - gtk_widget_set_sensitive(check, FALSE); - gtk_button_set_focus_on_click(GTK_BUTTON(check), FALSE); + check = ui_lookup_widget(dialog, "file_perm_owner_w_check"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), mode & S_IWUSR); - gtk_table_attach(GTK_TABLE(perm_table), check, 2, 3, 2, 3, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_button_set_alignment(GTK_BUTTON(check), 0.5, 0); - - check = gtk_check_button_new(); - gtk_widget_set_sensitive(check, FALSE); - gtk_button_set_focus_on_click(GTK_BUTTON(check), FALSE); + check = ui_lookup_widget(dialog, "file_perm_owner_x_check"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), mode & S_IXUSR); - gtk_table_attach(GTK_TABLE(perm_table), check, 3, 4, 2, 3, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_button_set_alignment(GTK_BUTTON(check), 0.5, 0); - - - /* Group */ - label = gtk_label_new(_("Group:")); - gtk_table_attach(GTK_TABLE(perm_table), label, 0, 1, 3, 4, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0); - - check = gtk_check_button_new(); - gtk_widget_set_sensitive(check, FALSE); - gtk_button_set_focus_on_click(GTK_BUTTON(check), FALSE); + check = ui_lookup_widget(dialog, "file_perm_group_r_check"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), mode & S_IRGRP); - gtk_table_attach(GTK_TABLE(perm_table), check, 1, 2, 3, 4, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_button_set_alignment(GTK_BUTTON(check), 0.5, 0); - - check = gtk_check_button_new(); - gtk_widget_set_sensitive(check, FALSE); - gtk_button_set_focus_on_click(GTK_BUTTON(check), FALSE); + check = ui_lookup_widget(dialog, "file_perm_group_w_check"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), mode & S_IWGRP); - gtk_table_attach(GTK_TABLE(perm_table), check, 2, 3, 3, 4, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_button_set_alignment(GTK_BUTTON(check), 0.5, 0); - - check = gtk_check_button_new(); - gtk_widget_set_sensitive(check, FALSE); - gtk_button_set_focus_on_click(GTK_BUTTON(check), FALSE); + check = ui_lookup_widget(dialog, "file_perm_group_x_check"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), mode & S_IXGRP); - gtk_table_attach(GTK_TABLE(perm_table), check, 3, 4, 3, 4, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_button_set_alignment(GTK_BUTTON(check), 0.5, 0); - - - /* Other */ - label = gtk_label_new(_("Other:")); - gtk_table_attach(GTK_TABLE(perm_table), label, 0, 1, 4, 5, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0); - - check = gtk_check_button_new(); - gtk_widget_set_sensitive(check, FALSE); - gtk_button_set_focus_on_click(GTK_BUTTON(check), FALSE); + check = ui_lookup_widget(dialog, "file_perm_other_r_check"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), mode & S_IROTH); - gtk_table_attach(GTK_TABLE(perm_table), check, 1, 2, 4, 5, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_button_set_alignment(GTK_BUTTON(check), 0.5, 0); - - check = gtk_check_button_new(); - gtk_widget_set_sensitive(check, FALSE); - gtk_button_set_focus_on_click(GTK_BUTTON(check), FALSE); + check = ui_lookup_widget(dialog, "file_perm_other_w_check"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), mode & S_IWOTH); - gtk_table_attach(GTK_TABLE(perm_table), check, 2, 3, 4, 5, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_button_set_alignment(GTK_BUTTON(check), 0.5, 0); - - check = gtk_check_button_new(); - gtk_widget_set_sensitive(check, FALSE); - gtk_button_set_focus_on_click(GTK_BUTTON(check), FALSE); + check = ui_lookup_widget(dialog, "file_perm_other_x_check"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), mode & S_IXOTH); - gtk_table_attach(GTK_TABLE(perm_table), check, 3, 4, 4, 5, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_button_set_alignment(GTK_BUTTON(check), 0.5, 0); - - gtk_box_pack_start(GTK_BOX(vbox), perm_table ,TRUE, TRUE, 0); g_free(base_name); g_free(time_changed); g_free(time_modified); g_free(time_accessed); - gtk_widget_show_all(dialog); + gtk_widget_show(dialog); }