Commit 66a0ce37 authored by Victor Ananjevsky's avatar Victor Ananjevsky

add --focused option to paned dialog

parent 6e319ffb
......@@ -788,7 +788,7 @@ Set active tab.
Expand all tabs to full width of a dialog window.
.TP
.B \-\-stack
Use stack mode (GtkStack instead of GtkNotebook).
Use stack mode (GtkStack instead of GtkNotebook).
.PP
See \fBNOTEBOOK and PANED\fP section for more about notebook dialog.
......@@ -830,6 +830,9 @@ Set orientation of panes inside dialog. \fITYPE\fP may be in \fIhor[izontal]\fP
.TP
.B \-\-splitter=\fIPOS\fP
Set the initial splitter position.
.TP
.B \-\-focused=\fIPANE\fP
Set pane for initial focus. \fIPANE\fP must be 1 or 2. Default is 1.
.PP
See \fBNOTEBOOK and PANED\fP section for more about paned dialog.
......
......@@ -541,6 +541,8 @@ static GOptionEntry paned_options[] = {
N_("Set orientation (hor[izontal] or vert[ical])"), N_("TYPE") },
{ "splitter", 0, 0, G_OPTION_ARG_INT, &options.paned_data.splitter,
N_("Set initial splitter position"), N_("POS") },
{ "focused", 0, 0, G_OPTION_ARG_INT, &options.paned_data.focused,
N_("Set focused pane (1 or 2)"), N_("PANE") },
{ NULL }
};
......@@ -1746,6 +1748,7 @@ yad_options_init (void)
/* Initialize paned data */
options.paned_data.orient = GTK_ORIENTATION_VERTICAL;
options.paned_data.splitter = -1;
options.paned_data.focused = 1;
/* Initialize picture data */
options.picture_data.size = YAD_PICTURE_ORIG;
......
......@@ -50,7 +50,7 @@ paned_create_widget (GtkWidget * dlg)
gtk_widget_set_name (w, "yad-paned-widget");
s = gtk_socket_new ();
gtk_widget_set_can_focus (s, TRUE);
gtk_widget_set_can_focus (s, TRUE);
gtk_paned_add1 (GTK_PANED (w), s);
g_object_set_data (G_OBJECT (w), "s1", s);
......@@ -82,8 +82,19 @@ paned_swallow_childs (void)
/* must be after embedding children */
if (options.paned_data.splitter > 0)
gtk_paned_set_position (GTK_PANED (paned), options.paned_data.splitter);
gtk_widget_child_focus (s1, GTK_DIR_TAB_FORWARD);
switch (options.paned_data.focused)
{
case 1:
gtk_widget_child_focus (s1, GTK_DIR_TAB_FORWARD);
break;
case 2:
gtk_widget_child_focus (s2, GTK_DIR_TAB_FORWARD);
break;
default:
if (options.debug)
g_printerr (_("WARNING: wrong focused pane number %d. Must be 1 or 2\n"), options.paned_data.focused);
}
}
void
......
......@@ -409,6 +409,7 @@ typedef struct {
typedef struct {
GtkOrientation orient;
gint splitter;
gint focused;
} YadPanedData;
typedef struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment