static void thunar_location_entry_init (ThunarLocationEntry *location_entry) { GtkSizeGroup *size_group; GtkWidget *button; GtkWidget *arrow; gtk_box_set_spacing (GTK_BOX (location_entry), 0); gtk_container_set_border_width (GTK_CONTAINER (location_entry), 4); location_entry->path_entry = thunar_path_entry_new (); exo_binding_new (G_OBJECT (location_entry), "current-directory", G_OBJECT (location_entry->path_entry), "current-file"); g_signal_connect_after (G_OBJECT (location_entry->path_entry), "activate", G_CALLBACK (thunar_location_entry_activate), location_entry); gtk_box_pack_start (GTK_BOX (location_entry), location_entry->path_entry, TRUE, TRUE, 0); gtk_widget_show (location_entry->path_entry); button = gtk_toggle_button_new (); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (thunar_location_entry_button_clicked), location_entry); g_signal_connect (G_OBJECT (button), "pressed", G_CALLBACK (thunar_location_entry_button_clicked), location_entry); gtk_box_pack_start (GTK_BOX (location_entry), button, FALSE, FALSE, 0); gtk_widget_show (button); arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); gtk_container_add (GTK_CONTAINER (button), arrow); gtk_widget_show (arrow); /* make sure the entry and the button request the same height */ size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL); gtk_size_group_add_widget (size_group, location_entry->path_entry); gtk_size_group_add_widget (size_group, button); g_object_unref (G_OBJECT (size_group)); }
static void thunar_chooser_button_activate_other (ThunarChooserButton *chooser_button) { GtkWidget *toplevel; GtkWidget *dialog; _thunar_return_if_fail (THUNAR_IS_CHOOSER_BUTTON (chooser_button)); /* determine the toplevel window for the chooser */ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (chooser_button)); if (G_UNLIKELY (toplevel == NULL)) return; /* popup the application chooser dialog */ dialog = g_object_new (THUNAR_TYPE_CHOOSER_DIALOG, "open", FALSE, NULL); exo_binding_new (G_OBJECT (chooser_button), "file", G_OBJECT (dialog), "file"); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel)); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); }
static void thunar_apr_desktop_page_init (ThunarAprDesktopPage *desktop_page) { AtkRelationSet *relations; PangoAttribute *attribute; PangoAttrList *attr_list; AtkRelation *relation; AtkObject *object; GtkWidget *table; GtkWidget *label; gtk_container_set_border_width (GTK_CONTAINER (desktop_page), 12); /* allocate shared bold Pango attributes */ attr_list = pango_attr_list_new (); attribute = pango_attr_weight_new (PANGO_WEIGHT_BOLD); attribute->start_index = 0; attribute->end_index = -1; pango_attr_list_insert (attr_list, attribute); table = gtk_table_new (8, 2, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 12); gtk_table_set_row_spacings (GTK_TABLE (table), 0); gtk_container_add (GTK_CONTAINER (desktop_page), table); gtk_widget_show (table); label = gtk_label_new (_("Description:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f); gtk_label_set_attributes (GTK_LABEL (label), attr_list); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (label); desktop_page->description_entry = gtk_entry_new (); gtk_widget_set_tooltip_text (desktop_page->description_entry, _("The generic name of the entry, for example \"Web Browser\" " "in case of Firefox.")); g_signal_connect (G_OBJECT (desktop_page->description_entry), "activate", G_CALLBACK (thunar_apr_desktop_page_activated), desktop_page); g_signal_connect (G_OBJECT (desktop_page->description_entry), "focus-out-event", G_CALLBACK (thunar_apr_desktop_page_focus_out_event), desktop_page); gtk_table_attach (GTK_TABLE (table), desktop_page->description_entry, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (desktop_page->description_entry); exo_binding_new (G_OBJECT (desktop_page->description_entry), "visible", G_OBJECT (label), "visible"); /* set Atk label relation for the entry */ object = gtk_widget_get_accessible (desktop_page->description_entry); relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); atk_relation_set_add (relations, relation); g_object_unref (G_OBJECT (relation)); label = gtk_label_new (_("Command:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f); gtk_label_set_attributes (GTK_LABEL (label), attr_list); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (label); desktop_page->command_entry = gtk_entry_new (); gtk_widget_set_tooltip_text (desktop_page->command_entry, _("The program to execute, possibly with arguments.")); g_signal_connect (G_OBJECT (desktop_page->command_entry), "activate", G_CALLBACK (thunar_apr_desktop_page_activated), desktop_page); g_signal_connect (G_OBJECT (desktop_page->command_entry), "focus-out-event", G_CALLBACK (thunar_apr_desktop_page_focus_out_event), desktop_page); gtk_table_attach (GTK_TABLE (table), desktop_page->command_entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (desktop_page->command_entry); exo_binding_new (G_OBJECT (desktop_page->command_entry), "visible", G_OBJECT (label), "visible"); /* set Atk label relation for the entry */ object = gtk_widget_get_accessible (desktop_page->command_entry); relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); atk_relation_set_add (relations, relation); g_object_unref (G_OBJECT (relation)); label = gtk_label_new (_("Working Directory:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f); gtk_label_set_attributes (GTK_LABEL (label), attr_list); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (label); desktop_page->path_entry = gtk_entry_new (); gtk_widget_set_tooltip_text (desktop_page->path_entry, _("The working directory for the program.")); g_signal_connect (G_OBJECT (desktop_page->path_entry), "activate", G_CALLBACK (thunar_apr_desktop_page_activated), desktop_page); g_signal_connect (G_OBJECT (desktop_page->path_entry), "focus-out-event", G_CALLBACK (thunar_apr_desktop_page_focus_out_event), desktop_page); gtk_table_attach (GTK_TABLE (table), desktop_page->path_entry, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (desktop_page->path_entry); exo_binding_new (G_OBJECT (desktop_page->path_entry), "visible", G_OBJECT (label), "visible"); /* set Atk label relation for the entry */ object = gtk_widget_get_accessible (desktop_page->path_entry); relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); atk_relation_set_add (relations, relation); g_object_unref (G_OBJECT (relation)); label = gtk_label_new (_("URL:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f); gtk_label_set_attributes (GTK_LABEL (label), attr_list); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (label); desktop_page->url_entry = gtk_entry_new (); gtk_widget_set_tooltip_text (desktop_page->url_entry, _("The URL to access.")); g_signal_connect (G_OBJECT (desktop_page->url_entry), "activate", G_CALLBACK (thunar_apr_desktop_page_activated), desktop_page); g_signal_connect (G_OBJECT (desktop_page->url_entry), "focus-out-event", G_CALLBACK (thunar_apr_desktop_page_focus_out_event), desktop_page); gtk_table_attach (GTK_TABLE (table), desktop_page->url_entry, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (desktop_page->url_entry); exo_binding_new (G_OBJECT (desktop_page->url_entry), "visible", G_OBJECT (label), "visible"); /* set Atk label relation for the entry */ object = gtk_widget_get_accessible (desktop_page->url_entry); relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); atk_relation_set_add (relations, relation); g_object_unref (G_OBJECT (relation)); label = gtk_label_new (_("Comment:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f); gtk_label_set_attributes (GTK_LABEL (label), attr_list); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (label); desktop_page->comment_entry = gtk_entry_new (); gtk_widget_set_tooltip_text (desktop_page->comment_entry, _("Tooltip for the entry, for example \"View sites on the Internet\" " "in case of Firefox. Should not be redundant with the name or the " "description.")); g_signal_connect (G_OBJECT (desktop_page->comment_entry), "activate", G_CALLBACK (thunar_apr_desktop_page_activated), desktop_page); g_signal_connect (G_OBJECT (desktop_page->comment_entry), "focus-out-event", G_CALLBACK (thunar_apr_desktop_page_focus_out_event), desktop_page); gtk_table_attach (GTK_TABLE (table), desktop_page->comment_entry, 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (desktop_page->comment_entry); exo_binding_new (G_OBJECT (desktop_page->comment_entry), "visible", G_OBJECT (label), "visible"); /* set Atk label relation for the entry */ object = gtk_widget_get_accessible (desktop_page->comment_entry); relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); atk_relation_set_add (relations, relation); g_object_unref (G_OBJECT (relation)); /* add spacing between the entries and the options */ gtk_table_set_row_spacing (GTK_TABLE (table), 4, 24); label = gtk_label_new (_("Options:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f); gtk_label_set_attributes (GTK_LABEL (label), attr_list); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 6, 7, GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (label); desktop_page->snotify_button = gtk_check_button_new_with_mnemonic (_("Use _startup notification")); gtk_widget_set_tooltip_text (desktop_page->snotify_button, _("Select this option to enable startup notification when the command " "is run from the file manager or the menu. Not every application supports " "startup notification.")); g_signal_connect (G_OBJECT (desktop_page->snotify_button), "toggled", G_CALLBACK (thunar_apr_desktop_page_toggled), desktop_page); gtk_table_attach (GTK_TABLE (table), desktop_page->snotify_button, 1, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (desktop_page->snotify_button); desktop_page->terminal_button = gtk_check_button_new_with_mnemonic (_("Run in _terminal")); gtk_widget_set_tooltip_text (desktop_page->terminal_button, _("Select this option to run the command in a terminal window.")); g_signal_connect (G_OBJECT (desktop_page->terminal_button), "toggled", G_CALLBACK (thunar_apr_desktop_page_toggled), desktop_page); gtk_table_attach (GTK_TABLE (table), desktop_page->terminal_button, 1, 2, 7, 8, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 3); gtk_widget_show (desktop_page->terminal_button); /* set Atk label relation for the buttons */ relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); object = gtk_widget_get_accessible (desktop_page->snotify_button); relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); atk_relation_set_add (relations, relation); g_object_unref (G_OBJECT (relation)); object = gtk_widget_get_accessible (desktop_page->terminal_button); relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); atk_relation_set_add (relations, relation); g_object_unref (G_OBJECT (relation)); exo_binding_new (G_OBJECT (desktop_page->snotify_button), "visible", G_OBJECT (label), "visible"); /* release shared bold Pango attributes */ pango_attr_list_unref (attr_list); }
void places_cfg_open_dialog(PlacesCfg *cfg) { GtkWidget *dlg; GtkWidget *frame_button, *vbox_button; GtkWidget *frame_menu, *vbox_menu; #if USE_RECENT_DOCUMENTS GtkWidget *frame_recent, *vbox_recent; #endif GtkWidget *frame_search, *vbox_search; GtkWidget *tmp_box, *tmp_label, *tmp_widget; GtkObject * adj; DBG("configure plugin"); dlg = pcfg_make_empty_dialog(cfg); /* BUTTON: frame, vbox */ vbox_button = gtk_vbox_new(FALSE, 4); gtk_widget_show(vbox_button); frame_button = xfce_gtk_frame_box_new_with_content(_("Button"), vbox_button); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), frame_button, FALSE, FALSE, 0); /* BUTTON: Show Icon/Label */ tmp_box = gtk_hbox_new(FALSE, 15); gtk_widget_show(tmp_box); gtk_box_pack_start(GTK_BOX(vbox_button), tmp_box, FALSE, FALSE, 0); tmp_label = gtk_label_new_with_mnemonic(_("_Show")); gtk_widget_show(tmp_label); gtk_box_pack_start(GTK_BOX(tmp_box), tmp_label, FALSE, FALSE, 0); tmp_widget = gtk_combo_box_new_text(); gtk_label_set_mnemonic_widget(GTK_LABEL(tmp_label), tmp_widget); gtk_combo_box_append_text(GTK_COMBO_BOX(tmp_widget), _("Icon Only")); gtk_combo_box_append_text(GTK_COMBO_BOX(tmp_widget), _("Label Only")); gtk_combo_box_append_text(GTK_COMBO_BOX(tmp_widget), _("Icon and Label")); exo_mutual_binding_new (G_OBJECT (cfg), "show-button-type", G_OBJECT (tmp_widget), "active"); gtk_widget_show(tmp_widget); gtk_box_pack_start(GTK_BOX(tmp_box), tmp_widget, FALSE, FALSE, 0); /* BUTTON: Label text entry */ tmp_box = gtk_hbox_new(FALSE, 15); gtk_widget_show(tmp_box); gtk_box_pack_start(GTK_BOX(vbox_button), tmp_box, FALSE, FALSE, 0); tmp_label = gtk_label_new_with_mnemonic(_("_Label")); gtk_widget_show(tmp_label); gtk_box_pack_start(GTK_BOX(tmp_box), tmp_label, FALSE, FALSE, 0); tmp_widget = gtk_entry_new(); gtk_label_set_mnemonic_widget(GTK_LABEL(tmp_label), tmp_widget); exo_mutual_binding_new (G_OBJECT (cfg), "button-label", G_OBJECT (tmp_widget), "text"); gtk_widget_show(tmp_widget); gtk_box_pack_start(GTK_BOX(tmp_box), tmp_widget, FALSE, FALSE, 0); /* MENU: frame, vbox */ vbox_menu = gtk_vbox_new(FALSE, 4); gtk_widget_show(vbox_menu); frame_menu = xfce_gtk_frame_box_new_with_content(_("Menu"), vbox_menu); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), frame_menu, FALSE, FALSE, 0); /* MENU: Show Icons */ tmp_widget = gtk_check_button_new_with_mnemonic(_("Show _icons in menu")); exo_mutual_binding_new (G_OBJECT (cfg), "show-icons", G_OBJECT (tmp_widget), "active"); gtk_widget_show(tmp_widget); gtk_box_pack_start(GTK_BOX(vbox_menu), tmp_widget, FALSE, FALSE, 0); /* MENU: Show Removable Media */ tmp_widget = gtk_check_button_new_with_mnemonic(_("Show _removable media")); exo_mutual_binding_new (G_OBJECT (cfg), "show-volumes", G_OBJECT (tmp_widget), "active"); gtk_widget_show(tmp_widget); gtk_box_pack_start(GTK_BOX(vbox_menu), tmp_widget, FALSE, FALSE, 0); /* MENU: - Mount and Open (indented) */ tmp_box = gtk_hbox_new(FALSE, 15); /* Gray out this box when "Show removable media" is off */ exo_binding_new (G_OBJECT (cfg), "show-volumes", G_OBJECT (tmp_box), "sensitive"); tmp_widget = gtk_label_new(" "); /* TODO: is there a more appropriate widget? */ gtk_widget_show(tmp_widget); gtk_box_pack_start(GTK_BOX(tmp_box), tmp_widget, FALSE, FALSE, 0); tmp_widget = gtk_check_button_new_with_mnemonic(_("Mount and _Open on click")); exo_mutual_binding_new (G_OBJECT (cfg), "mount-open-volumes", G_OBJECT (tmp_widget), "active"); gtk_widget_show(tmp_widget); gtk_box_pack_start(GTK_BOX(tmp_box), tmp_widget, FALSE, FALSE, 0); gtk_widget_show(tmp_box); gtk_box_pack_start(GTK_BOX(vbox_menu), tmp_box, FALSE, FALSE, 0); /* MENU: Show GTK Bookmarks */ tmp_widget = gtk_check_button_new_with_mnemonic(_("Show GTK _bookmarks")); exo_mutual_binding_new (G_OBJECT (cfg), "show-bookmarks", G_OBJECT (tmp_widget), "active"); gtk_widget_show(tmp_widget); gtk_box_pack_start(GTK_BOX(vbox_menu), tmp_widget, FALSE, FALSE, 0); #if USE_RECENT_DOCUMENTS /* MENU: Show Recent Documents */ tmp_widget = gtk_check_button_new_with_mnemonic(_("Show recent _documents")); exo_mutual_binding_new (G_OBJECT (cfg), "show-recent", G_OBJECT (tmp_widget), "active"); gtk_widget_show(tmp_widget); gtk_box_pack_start(GTK_BOX(vbox_menu), tmp_widget, FALSE, FALSE, 0); /* RECENT DOCUMENTS: frame, vbox */ vbox_recent = gtk_vbox_new(FALSE, 4); gtk_widget_show(vbox_recent); /* Gray out this box when "Show recent documents" is off */ exo_binding_new (G_OBJECT (cfg), "show-recent", G_OBJECT (vbox_recent), "sensitive"); frame_recent = xfce_gtk_frame_box_new_with_content(_("Recent Documents"), vbox_recent); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), frame_recent, FALSE, FALSE, 0); /* RECENT DOCUMENTS: Show clear option */ tmp_widget = gtk_check_button_new_with_mnemonic(_("Show cl_ear option")); exo_mutual_binding_new (G_OBJECT (cfg), "show-recent-clear", G_OBJECT (tmp_widget), "active"); gtk_widget_show(tmp_widget); gtk_box_pack_start(GTK_BOX(vbox_recent), tmp_widget, FALSE, FALSE, 0); /* RECENT DOCUMENTS: Number to display */ tmp_box = gtk_hbox_new(FALSE, 15); gtk_widget_show(tmp_box); gtk_box_pack_start(GTK_BOX(vbox_recent), tmp_box, FALSE, FALSE, 0); tmp_label = gtk_label_new_with_mnemonic(_("_Number to display")); gtk_widget_show(tmp_label); gtk_box_pack_start(GTK_BOX(tmp_box), tmp_label, FALSE, FALSE, 0); adj = gtk_adjustment_new(cfg->show_recent_number, 1, 25, 1, 5, 0); tmp_widget = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0); gtk_label_set_mnemonic_widget(GTK_LABEL(tmp_label), tmp_widget); exo_mutual_binding_new (G_OBJECT (cfg), "show-recent-number", G_OBJECT (adj), "value"); gtk_widget_show(tmp_widget); gtk_box_pack_start(GTK_BOX(tmp_box), tmp_widget, FALSE, FALSE, 0); #endif /* Search: frame, vbox */ vbox_search = gtk_vbox_new(FALSE, 4); gtk_widget_show(vbox_search); frame_search = xfce_gtk_frame_box_new_with_content(_("Search"), vbox_search); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), frame_search, FALSE, FALSE, 0); /* Search: command */ tmp_box = gtk_hbox_new(FALSE, 15); gtk_widget_show(tmp_box); gtk_box_pack_start(GTK_BOX(vbox_search), tmp_box, FALSE, FALSE, 0); tmp_label = gtk_label_new_with_mnemonic(_("Co_mmand")); gtk_widget_show(tmp_label); gtk_box_pack_start(GTK_BOX(tmp_box), tmp_label, FALSE, FALSE, 0); tmp_widget = gtk_entry_new(); gtk_label_set_mnemonic_widget(GTK_LABEL(tmp_label), tmp_widget); exo_mutual_binding_new (G_OBJECT (cfg), "search-cmd", G_OBJECT (tmp_widget), "text"); gtk_widget_show(tmp_widget); gtk_box_pack_start(GTK_BOX(tmp_box), tmp_widget, FALSE, FALSE, 0); gtk_widget_show_all(dlg); }