Commit c8823f99 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Only handle key bindings for tab reordering if the tabs are shown and

2007-01-01  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtknotebook.h:
        * gtk/gtknotebook.c: Only handle key bindings for
        tab reordering if the tabs are shown and reorderable.
        (#390468, Yevgen Muntyan)

        * gtk/gtkmarshalers.list: Add required marshaler



svn path=/trunk/; revision=17008
parent c88eb9ea
2007-01-01 Matthias Clasen <mclasen@redhat.com>
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: Only handle key bindings for
tab reordering if the tabs are shown and reorderable.
(#390468, Yevgen Muntyan)
* gtk/gtkmarshalers.list: Add required marshaler
2007-01-01 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcontainer.c (gtk_container_class_list_child_properties):
......
......@@ -24,6 +24,7 @@
BOOLEAN:BOXED
BOOLEAN:BOXED,BOXED
BOOLEAN:ENUM
BOOLEAN:ENUM,BOOLEAN
BOOLEAN:ENUM,DOUBLE
BOOLEAN:ENUM,INT
BOOLEAN:OBJECT
......
......@@ -201,11 +201,11 @@ static gboolean gtk_notebook_select_page (GtkNotebook *notebook,
gboolean move_focus);
static gboolean gtk_notebook_focus_tab (GtkNotebook *notebook,
GtkNotebookTab type);
static void gtk_notebook_change_current_page (GtkNotebook *notebook,
static gboolean gtk_notebook_change_current_page (GtkNotebook *notebook,
gint offset);
static void gtk_notebook_move_focus_out (GtkNotebook *notebook,
GtkDirectionType direction_type);
static void gtk_notebook_reorder_tab (GtkNotebook *notebook,
static gboolean gtk_notebook_reorder_tab (GtkNotebook *notebook,
GtkDirectionType direction_type,
gboolean move_to_last);
......@@ -815,8 +815,8 @@ gtk_notebook_class_init (GtkNotebookClass *class)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkNotebookClass, change_current_page),
NULL, NULL,
_gtk_marshal_VOID__INT,
G_TYPE_NONE, 1,
_gtk_marshal_BOOLEAN__INT,
G_TYPE_BOOLEAN, 1,
G_TYPE_INT);
notebook_signals[MOVE_FOCUS_OUT] =
g_signal_new (I_("move_focus_out"),
......@@ -833,8 +833,8 @@ gtk_notebook_class_init (GtkNotebookClass *class)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkNotebookClass, reorder_tab),
NULL, NULL,
_gtk_marshal_VOID__ENUM_BOOLEAN,
G_TYPE_NONE, 2,
_gtk_marshal_BOOLEAN__ENUM_BOOLEAN,
G_TYPE_BOOLEAN, 2,
GTK_TYPE_DIRECTION_TYPE,
G_TYPE_BOOLEAN);
/**
......@@ -1026,7 +1026,7 @@ static gboolean
gtk_notebook_select_page (GtkNotebook *notebook,
gboolean move_focus)
{
if (gtk_widget_is_focus (GTK_WIDGET (notebook)))
if (gtk_widget_is_focus (GTK_WIDGET (notebook)) && notebook->show_tabs)
{
gtk_notebook_page_select (notebook, move_focus);
return TRUE;
......@@ -1041,7 +1041,7 @@ gtk_notebook_focus_tab (GtkNotebook *notebook,
{
GList *list;
if (gtk_widget_is_focus (GTK_WIDGET (notebook)))
if (gtk_widget_is_focus (GTK_WIDGET (notebook)) && notebook->show_tabs)
{
switch (type)
{
......@@ -1063,12 +1063,15 @@ gtk_notebook_focus_tab (GtkNotebook *notebook,
return FALSE;
}
static void
static gboolean
gtk_notebook_change_current_page (GtkNotebook *notebook,
gint offset)
{
GList *current = NULL;
if (!notebook->show_tabs)
return FALSE;
if (notebook->cur_page)
current = g_list_find (notebook->children, notebook->cur_page);
......@@ -1101,6 +1104,8 @@ gtk_notebook_change_current_page (GtkNotebook *notebook,
gtk_notebook_switch_page (notebook, current->data, -1);
else
gtk_widget_error_bell (GTK_WIDGET (notebook));
return TRUE;
}
static GtkDirectionType
......@@ -1248,7 +1253,7 @@ reorder_tab (GtkNotebook *notebook, GList *position, GList *tab)
return g_list_position (notebook->children, tab);
}
static void
static gboolean
gtk_notebook_reorder_tab (GtkNotebook *notebook,
GtkDirectionType direction_type,
gboolean move_to_last)
......@@ -1258,16 +1263,16 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook,
GList *last, *child;
gint page_num;
if (!gtk_widget_is_focus (GTK_WIDGET (notebook)))
return;
if (!gtk_widget_is_focus (GTK_WIDGET (notebook)) || !notebook->show_tabs)
return FALSE;
if (!notebook->cur_page ||
!notebook->cur_page->reorderable)
return;
return FALSE;
if (effective_direction != GTK_DIR_LEFT &&
effective_direction != GTK_DIR_RIGHT)
return;
return FALSE;
if (move_to_last)
{
......@@ -1290,7 +1295,7 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook,
TRUE);
if (!child || child->data == notebook->cur_page)
return;
return FALSE;
page = child->data;
......@@ -1308,7 +1313,11 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook,
0,
((GtkNotebookPage *) notebook->focus_tab->data)->child,
page_num);
return TRUE;
}
return FALSE;
}
/**
......
......@@ -101,11 +101,11 @@ struct _GtkNotebookClass
gboolean move_focus);
gboolean (* focus_tab) (GtkNotebook *notebook,
GtkNotebookTab type);
void (* change_current_page) (GtkNotebook *notebook,
gboolean (* change_current_page) (GtkNotebook *notebook,
gint offset);
void (* move_focus_out) (GtkNotebook *notebook,
GtkDirectionType direction);
void (* reorder_tab) (GtkNotebook *notebook,
gboolean (* reorder_tab) (GtkNotebook *notebook,
GtkDirectionType direction,
gboolean move_to_last);
......
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