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
This commit is contained in:
Matthias Clasen 2007-01-02 06:22:37 +00:00 committed by Matthias Clasen
parent c88eb9ead7
commit c8823f99e1
4 changed files with 36 additions and 17 deletions

View File

@ -1,3 +1,12 @@
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):

View File

@ -24,6 +24,7 @@
BOOLEAN:BOXED
BOOLEAN:BOXED,BOXED
BOOLEAN:ENUM
BOOLEAN:ENUM,BOOLEAN
BOOLEAN:ENUM,DOUBLE
BOOLEAN:ENUM,INT
BOOLEAN:OBJECT

View File

@ -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;
}
/**

View File

@ -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);