Gtk::Widget *FileSystemSyncServiceAddin::create_preferences_control(EventHandler requiredPrefChanged)
{
  Gtk::Table *table = new Gtk::Table(1, 2, false);
  table->set_row_spacings(5);
  table->set_col_spacings(10);

  // Read settings out of gconf
  std::string syncPath;
  if(get_config_settings(syncPath) == false) {
    syncPath = "";
  }

  Gtk::Label *l = new Gtk::Label(_("_Folder Path:"), true);
  l->property_xalign() = 1;
  table->attach(*l, 0, 1, 0, 1,
                Gtk::FILL,
                Gtk::EXPAND | Gtk::FILL,
                0, 0);

  m_path_button = new Gtk::FileChooserButton(_("Select Synchronization Folder..."),
    Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
  m_path_button->signal_current_folder_changed().connect(requiredPrefChanged);
  l->set_mnemonic_widget(*m_path_button);
  m_path_button->set_filename(syncPath);

  table->attach(*m_path_button, 1, 2, 0, 1,
                Gtk::EXPAND | Gtk::FILL,
                Gtk::EXPAND | Gtk::FILL,
                0, 0);

  table->show_all();
  return table;
}
void WebDavSyncServiceAddin::add_row(Gtk::Table *table, Gtk::Widget *widget, const Glib::ustring & labelText, uint row)
{
  Gtk::Label *l = new Gtk::Label(labelText);
  l->set_use_underline(true);
  l->property_xalign() = 0.0f;
  l->show();
  table->attach(*l, 0, 1, row, row + 1,
		Gtk::FILL,
		Gtk::EXPAND | Gtk::FILL,
		0, 0);

  widget->show();
  table->attach(*widget, 1, 2, row, row + 1,
		Gtk::EXPAND | Gtk::FILL,
		Gtk::EXPAND | Gtk::FILL,
		0, 0);

  l->set_mnemonic_widget(*widget);

  // TODO: Tooltips
}
Exemple #3
0
BugzillaPreferences::BugzillaPreferences()
    : Gtk::VBox(false, 12)
{
    _init_static();
    last_opened_dir = Glib::get_home_dir();

    Gtk::Label *l = manage(new Gtk::Label (_("You can use any bugzilla just by dragging links "
                                           "into notes.  If you want a special icon for "
                                           "certain hosts, add them here.")));
    l->property_wrap() = true;
    l->property_xalign() = 0;

    pack_start(*l, false, false, 0);

    icon_store = Gtk::ListStore::create(m_columns);
    icon_store->set_sort_column(m_columns.host, Gtk::SORT_ASCENDING);

    icon_tree = manage(new Gtk::TreeView (icon_store));
    icon_tree->set_headers_visible(true);
    icon_tree->get_selection()->set_mode(Gtk::SELECTION_SINGLE);
    icon_tree->get_selection()->signal_changed().connect(
        sigc::mem_fun(*this, &BugzillaPreferences::selection_changed));

    Gtk::TreeViewColumn *host_col = manage(new Gtk::TreeViewColumn(_("Host Name"), m_columns.host));
    host_col->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
    host_col->set_resizable(true);
    host_col->set_expand(true);
    host_col->set_min_width(200);

    host_col->set_sort_column(m_columns.host);
    host_col->set_sort_indicator(false);
    host_col->set_reorderable(false);
    host_col->set_sort_order(Gtk::SORT_ASCENDING);

    icon_tree->append_column (*host_col);

    Gtk::TreeViewColumn *icon_col = manage(new Gtk::TreeViewColumn(_("Icon"), m_columns.icon));
    icon_col->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED);
    icon_col->set_max_width(50);
    icon_col->set_min_width(50);
    icon_col->set_resizable(false);

    icon_tree->append_column (*icon_col);

    Gtk::ScrolledWindow *sw = manage(new Gtk::ScrolledWindow ());
    sw->set_shadow_type(Gtk::SHADOW_IN);
    sw->property_height_request() = 200;
    sw->property_width_request() = 300;
    sw->set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    sw->add (*icon_tree);

    pack_start(*sw, true, true, 0);

    add_button = manage(new Gtk::Button (Gtk::Stock::ADD));
    add_button->signal_clicked().connect(
        sigc::mem_fun(*this, &BugzillaPreferences::add_clicked));

    remove_button = manage(new Gtk::Button (Gtk::Stock::REMOVE));
    remove_button->set_sensitive(false);
    remove_button->signal_clicked().connect(
        sigc::mem_fun(*this,  &BugzillaPreferences::remove_clicked));

    Gtk::HButtonBox *hbutton_box = manage(new Gtk::HButtonBox ());
    hbutton_box->set_layout(Gtk::BUTTONBOX_START);
    hbutton_box->set_spacing(6);

    hbutton_box->pack_start(*add_button);
    hbutton_box->pack_start(*remove_button);
    pack_start(*hbutton_box, false, false, 0);

    show_all ();
}