--- /dev/null
+/**
+ * \file GBranch.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Bernhard Reiter
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+// Too hard to make concept checks work with this file
+#ifdef _GLIBCXX_CONCEPT_CHECKS
+#undef _GLIBCXX_CONCEPT_CHECKS
+#endif
+#ifdef _GLIBCPP_CONCEPT_CHECKS
+#undef _GLIBCPP_CONCEPT_CHECKS
+#endif
+
+#include "GBranch.h"
+#include "ControlBranch.h"
+
+#include "BranchList.h"
+#include "insets/insetbranch.h"
+
+#include "ghelpers.h"
+
+#include <libglademm.h>
+
+using std::string;
+
+namespace lyx {
+namespace frontend {
+
+
+GBranch::GBranch(Dialog & parent)
+ : GViewCB<ControlBranch, GViewGladeB>(parent, _("Branch Settings"), false)
+{}
+
+
+void GBranch::doBuild()
+{
+ string const gladeName = findGladeFile("branch");
+ xml_ = Gnome::Glade::Xml::create(gladeName);
+
+ xml_->get_widget("Cancel", cancelbutton_);
+ setCancel(cancelbutton_);
+ xml_->get_widget("OK", okbutton_);
+ setOK(okbutton_);
+
+ Gtk::Box * box = NULL;
+ xml_->get_widget("innerbox", box);
+ box->pack_start(branchescombo_, true, true, 0);
+ box->show_all();
+
+ // Set shortcut target
+ xml_->get_widget("BranchesLabel", brancheslabel_);
+ brancheslabel_->set_mnemonic_widget(branchescombo_);
+
+ // Single click in branches list
+ branchescombo_.signal_changed().connect(
+ sigc::mem_fun(*this, &GBranch::selection_changed));
+
+}
+
+
+void GBranch::update()
+{
+ applylock_ = true;
+
+ typedef BranchList::const_iterator const_iterator;
+
+ BranchList const branchlist = controller().branchlist();
+ string const cur_branch = controller().params().branch;
+
+ branchescombo_.clear_items();
+
+ const_iterator const begin = branchlist.begin();
+ const_iterator const end = branchlist.end();
+ for (const_iterator it = begin; it != end; ++it)
+ branchescombo_.append_text(it->getBranch());
+ branchescombo_.set_active_text(cur_branch);
+
+ applylock_ = false;
+}
+
+
+void GBranch::apply()
+{
+ controller().params().branch = branchescombo_.get_active_text();;
+}
+
+
+void GBranch::selection_changed()
+{
+ if (!applylock_)
+ bc().valid(true);
+}
+
+
+} // namespace frontend
+} // namespace lyx
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file GBranch.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Bernhard Reiter
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GBRANCH_H
+#define GBRANCH_H
+
+#include "GViewBase.h"
+
+namespace lyx {
+namespace frontend {
+
+class ControlBranch;
+
+/** This class provides a GTK+ implementation of the Branch Dialog.
+ */
+class GBranch : public GViewCB<ControlBranch, GViewGladeB> {
+public:
+ GBranch(Dialog & parent);
+private:
+ virtual void apply();
+ virtual void doBuild();
+ virtual void update();
+
+ /// enables the apply button if a synonym is selected from the list
+ void selection_changed();
+
+ /** apply() won't act when this is true.
+ true if no text is selected when the Branch dialog is opened
+ */
+ bool applylock_;
+
+ Gtk::Button * cancelbutton_;
+ Gtk::Button * okbutton_;
+ Gtk::Label * brancheslabel_;
+ Gtk::ComboBoxText branchescombo_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GBRANCH_H
--- /dev/null
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkDialog" id="dialog">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">dialog1</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="Cancel">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-6</property>
+ <accelerator key="Escape" modifiers="0" signal="clicked"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="OK">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-5</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="outerbox">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="BranchesLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Available branches:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="innerbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>