xed-documents-panel: Cleanup code styling
This commit is contained in:
parent
21f524a7b3
commit
76ce469bfa
|
@ -53,7 +53,7 @@ struct _XedDocumentsPanelPrivate
|
||||||
guint is_reodering : 1;
|
guint is_reodering : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE(XedDocumentsPanel, xed_documents_panel, GTK_TYPE_BOX)
|
G_DEFINE_TYPE (XedDocumentsPanel, xed_documents_panel, GTK_TYPE_BOX)
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -92,23 +92,18 @@ tab_get_name (XedTab *tab)
|
||||||
{
|
{
|
||||||
if (xed_document_get_readonly (doc))
|
if (xed_document_get_readonly (doc))
|
||||||
{
|
{
|
||||||
tab_name = g_markup_printf_escaped ("<i>%s</i> [<i>%s</i>]",
|
tab_name = g_markup_printf_escaped ("<i>%s</i> [<i>%s</i>]", docname, _("Read-Only"));
|
||||||
docname,
|
|
||||||
_("Read-Only"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tab_name = g_markup_printf_escaped ("<i>%s</i>",
|
tab_name = g_markup_printf_escaped ("<i>%s</i>", docname);
|
||||||
docname);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (xed_document_get_readonly (doc))
|
if (xed_document_get_readonly (doc))
|
||||||
{
|
{
|
||||||
tab_name = g_markup_printf_escaped ("%s [<i>%s</i>]",
|
tab_name = g_markup_printf_escaped ("%s [<i>%s</i>]", docname, _("Read-Only"));
|
||||||
docname,
|
|
||||||
_("Read-Only"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -123,20 +118,19 @@ tab_get_name (XedTab *tab)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_iter_from_tab (XedDocumentsPanel *panel, XedTab *tab, GtkTreeIter *iter)
|
get_iter_from_tab (XedDocumentsPanel *panel,
|
||||||
|
XedTab *tab,
|
||||||
|
GtkTreeIter *iter)
|
||||||
{
|
{
|
||||||
gint num;
|
gint num;
|
||||||
GtkWidget *nb;
|
GtkWidget *nb;
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
|
|
||||||
nb = _xed_window_get_notebook (panel->priv->window);
|
nb = _xed_window_get_notebook (panel->priv->window);
|
||||||
num = gtk_notebook_page_num (GTK_NOTEBOOK (nb),
|
num = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
|
||||||
GTK_WIDGET (tab));
|
|
||||||
|
|
||||||
path = gtk_tree_path_new_from_indices (num, -1);
|
path = gtk_tree_path_new_from_indices (num, -1);
|
||||||
gtk_tree_model_get_iter (panel->priv->model,
|
gtk_tree_model_get_iter (panel->priv->model, iter, path);
|
||||||
iter,
|
|
||||||
path);
|
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,11 +148,9 @@ window_active_tab_changed (XedWindow *window,
|
||||||
|
|
||||||
get_iter_from_tab (panel, tab, &iter);
|
get_iter_from_tab (panel, tab, &iter);
|
||||||
|
|
||||||
if (gtk_list_store_iter_is_valid (GTK_LIST_STORE (panel->priv->model),
|
if (gtk_list_store_iter_is_valid (GTK_LIST_STORE (panel->priv->model), &iter))
|
||||||
&iter))
|
|
||||||
{
|
{
|
||||||
selection = gtk_tree_view_get_selection (
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (panel->priv->treeview));
|
||||||
GTK_TREE_VIEW (panel->priv->treeview));
|
|
||||||
|
|
||||||
gtk_tree_selection_select_iter (selection, &iter);
|
gtk_tree_selection_select_iter (selection, &iter);
|
||||||
}
|
}
|
||||||
|
@ -202,8 +194,7 @@ refresh_list (XedDocumentsPanel *panel)
|
||||||
|
|
||||||
/* Add a new row to the model */
|
/* Add a new row to the model */
|
||||||
gtk_list_store_append (list_store, &iter);
|
gtk_list_store_append (list_store, &iter);
|
||||||
gtk_list_store_set (list_store,
|
gtk_list_store_set (list_store, &iter,
|
||||||
&iter,
|
|
||||||
PIXBUF_COLUMN, pixbuf,
|
PIXBUF_COLUMN, pixbuf,
|
||||||
NAME_COLUMN, name,
|
NAME_COLUMN, name,
|
||||||
TAB_COLUMN, l->data,
|
TAB_COLUMN, l->data,
|
||||||
|
@ -211,14 +202,15 @@ refresh_list (XedDocumentsPanel *panel)
|
||||||
|
|
||||||
g_free (name);
|
g_free (name);
|
||||||
if (pixbuf != NULL)
|
if (pixbuf != NULL)
|
||||||
|
{
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
|
}
|
||||||
|
|
||||||
if (l->data == active_tab)
|
if (l->data == active_tab)
|
||||||
{
|
{
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
|
|
||||||
selection = gtk_tree_view_get_selection (
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (panel->priv->treeview));
|
||||||
GTK_TREE_VIEW (panel->priv->treeview));
|
|
||||||
|
|
||||||
gtk_tree_selection_select_iter (selection, &iter);
|
gtk_tree_selection_select_iter (selection, &iter);
|
||||||
}
|
}
|
||||||
|
@ -245,8 +237,7 @@ sync_name_and_icon (XedTab *tab,
|
||||||
name = tab_get_name (tab);
|
name = tab_get_name (tab);
|
||||||
pixbuf = _xed_tab_get_icon (tab);
|
pixbuf = _xed_tab_get_icon (tab);
|
||||||
|
|
||||||
gtk_list_store_set (GTK_LIST_STORE (panel->priv->model),
|
gtk_list_store_set (GTK_LIST_STORE (panel->priv->model), &iter,
|
||||||
&iter,
|
|
||||||
PIXBUF_COLUMN, pixbuf,
|
PIXBUF_COLUMN, pixbuf,
|
||||||
NAME_COLUMN, name,
|
NAME_COLUMN, name,
|
||||||
TAB_COLUMN, tab,
|
TAB_COLUMN, tab,
|
||||||
|
@ -254,7 +245,9 @@ sync_name_and_icon (XedTab *tab,
|
||||||
|
|
||||||
g_free (name);
|
g_free (name);
|
||||||
if (pixbuf != NULL)
|
if (pixbuf != NULL)
|
||||||
|
{
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -262,14 +255,16 @@ window_tab_removed (XedWindow *window,
|
||||||
XedTab *tab,
|
XedTab *tab,
|
||||||
XedDocumentsPanel *panel)
|
XedDocumentsPanel *panel)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (tab,
|
g_signal_handlers_disconnect_by_func (tab, G_CALLBACK (sync_name_and_icon), panel);
|
||||||
G_CALLBACK (sync_name_and_icon),
|
|
||||||
panel);
|
|
||||||
|
|
||||||
if (_xed_window_is_removing_tabs (window))
|
if (_xed_window_is_removing_tabs (window))
|
||||||
|
{
|
||||||
gtk_list_store_clear (GTK_LIST_STORE (panel->priv->model));
|
gtk_list_store_clear (GTK_LIST_STORE (panel->priv->model));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
refresh_list (panel);
|
refresh_list (panel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -282,33 +277,22 @@ window_tab_added (XedWindow *window,
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
|
||||||
g_signal_connect (tab,
|
g_signal_connect (tab, "notify::name", G_CALLBACK (sync_name_and_icon), panel);
|
||||||
"notify::name",
|
g_signal_connect (tab, "notify::state", G_CALLBACK (sync_name_and_icon), panel);
|
||||||
G_CALLBACK (sync_name_and_icon),
|
|
||||||
panel);
|
|
||||||
|
|
||||||
g_signal_connect (tab,
|
|
||||||
"notify::state",
|
|
||||||
G_CALLBACK (sync_name_and_icon),
|
|
||||||
panel);
|
|
||||||
|
|
||||||
get_iter_from_tab (panel, tab, &sibling);
|
get_iter_from_tab (panel, tab, &sibling);
|
||||||
|
|
||||||
panel->priv->adding_tab = TRUE;
|
panel->priv->adding_tab = TRUE;
|
||||||
|
|
||||||
if (gtk_list_store_iter_is_valid (GTK_LIST_STORE (panel->priv->model),
|
if (gtk_list_store_iter_is_valid (GTK_LIST_STORE (panel->priv->model), &sibling))
|
||||||
&sibling))
|
|
||||||
{
|
{
|
||||||
gtk_list_store_insert_after (GTK_LIST_STORE (panel->priv->model),
|
gtk_list_store_insert_after (GTK_LIST_STORE (panel->priv->model), &iter, &sibling);
|
||||||
&iter,
|
|
||||||
&sibling);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XedTab *active_tab;
|
XedTab *active_tab;
|
||||||
|
|
||||||
gtk_list_store_append (GTK_LIST_STORE (panel->priv->model),
|
gtk_list_store_append (GTK_LIST_STORE (panel->priv->model), &iter);
|
||||||
&iter);
|
|
||||||
|
|
||||||
active_tab = xed_window_get_active_tab (panel->priv->window);
|
active_tab = xed_window_get_active_tab (panel->priv->window);
|
||||||
|
|
||||||
|
@ -316,9 +300,7 @@ window_tab_added (XedWindow *window,
|
||||||
{
|
{
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
|
|
||||||
selection = gtk_tree_view_get_selection (
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (panel->priv->treeview));
|
||||||
GTK_TREE_VIEW (panel->priv->treeview));
|
|
||||||
|
|
||||||
gtk_tree_selection_select_iter (selection, &iter);
|
gtk_tree_selection_select_iter (selection, &iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -326,8 +308,7 @@ window_tab_added (XedWindow *window,
|
||||||
name = tab_get_name (tab);
|
name = tab_get_name (tab);
|
||||||
pixbuf = _xed_tab_get_icon (tab);
|
pixbuf = _xed_tab_get_icon (tab);
|
||||||
|
|
||||||
gtk_list_store_set (GTK_LIST_STORE (panel->priv->model),
|
gtk_list_store_set (GTK_LIST_STORE (panel->priv->model), &iter,
|
||||||
&iter,
|
|
||||||
PIXBUF_COLUMN, pixbuf,
|
PIXBUF_COLUMN, pixbuf,
|
||||||
NAME_COLUMN, name,
|
NAME_COLUMN, name,
|
||||||
TAB_COLUMN, tab,
|
TAB_COLUMN, tab,
|
||||||
|
@ -335,7 +316,9 @@ window_tab_added (XedWindow *window,
|
||||||
|
|
||||||
g_free (name);
|
g_free (name);
|
||||||
if (pixbuf != NULL)
|
if (pixbuf != NULL)
|
||||||
|
{
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
|
}
|
||||||
|
|
||||||
panel->priv->adding_tab = FALSE;
|
panel->priv->adding_tab = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -345,7 +328,9 @@ window_tabs_reordered (XedWindow *window,
|
||||||
XedDocumentsPanel *panel)
|
XedDocumentsPanel *panel)
|
||||||
{
|
{
|
||||||
if (panel->priv->is_reodering)
|
if (panel->priv->is_reodering)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
refresh_list (panel);
|
refresh_list (panel);
|
||||||
}
|
}
|
||||||
|
@ -359,22 +344,10 @@ set_window (XedDocumentsPanel *panel,
|
||||||
|
|
||||||
panel->priv->window = g_object_ref (window);
|
panel->priv->window = g_object_ref (window);
|
||||||
|
|
||||||
g_signal_connect (window,
|
g_signal_connect (window, "tab_added", G_CALLBACK (window_tab_added), panel);
|
||||||
"tab_added",
|
g_signal_connect (window, "tab_removed", G_CALLBACK (window_tab_removed), panel);
|
||||||
G_CALLBACK (window_tab_added),
|
g_signal_connect (window, "tabs_reordered", G_CALLBACK (window_tabs_reordered), panel);
|
||||||
panel);
|
g_signal_connect (window, "active_tab_changed", G_CALLBACK (window_active_tab_changed), panel);
|
||||||
g_signal_connect (window,
|
|
||||||
"tab_removed",
|
|
||||||
G_CALLBACK (window_tab_removed),
|
|
||||||
panel);
|
|
||||||
g_signal_connect (window,
|
|
||||||
"tabs_reordered",
|
|
||||||
G_CALLBACK (window_tabs_reordered),
|
|
||||||
panel);
|
|
||||||
g_signal_connect (window,
|
|
||||||
"active_tab_changed",
|
|
||||||
G_CALLBACK (window_active_tab_changed),
|
|
||||||
panel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -385,21 +358,17 @@ treeview_cursor_changed (GtkTreeView *view,
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
gpointer tab;
|
gpointer tab;
|
||||||
|
|
||||||
selection = gtk_tree_view_get_selection (
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (panel->priv->treeview));
|
||||||
GTK_TREE_VIEW (panel->priv->treeview));
|
|
||||||
|
|
||||||
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
|
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||||
{
|
{
|
||||||
gtk_tree_model_get (panel->priv->model,
|
gtk_tree_model_get (panel->priv->model, &iter,
|
||||||
&iter,
|
TAB_COLUMN, &tab,
|
||||||
TAB_COLUMN,
|
|
||||||
&tab,
|
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
if (xed_window_get_active_tab (panel->priv->window) != tab)
|
if (xed_window_get_active_tab (panel->priv->window) != tab)
|
||||||
{
|
{
|
||||||
xed_window_set_active_tab (panel->priv->window,
|
xed_window_set_active_tab (panel->priv->window, XED_TAB (tab));
|
||||||
XED_TAB (tab));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,7 +386,6 @@ xed_documents_panel_set_property (GObject *object,
|
||||||
case PROP_WINDOW:
|
case PROP_WINDOW:
|
||||||
set_window (panel, g_value_get_object (value));
|
set_window (panel, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -435,8 +403,7 @@ xed_documents_panel_get_property (GObject *object,
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_WINDOW:
|
case PROP_WINDOW:
|
||||||
g_value_set_object (value,
|
g_value_set_object (value, XED_DOCUMENTS_PANEL_GET_PRIVATE (panel)->window);
|
||||||
XED_DOCUMENTS_PANEL_GET_PRIVATE (panel)->window);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -526,10 +493,7 @@ menu_position (GtkMenu *menu,
|
||||||
|
|
||||||
path = get_current_path (panel);
|
path = get_current_path (panel);
|
||||||
|
|
||||||
gtk_tree_view_get_cell_area (GTK_TREE_VIEW (w),
|
gtk_tree_view_get_cell_area (GTK_TREE_VIEW (w), path, NULL, &rect);
|
||||||
path,
|
|
||||||
NULL,
|
|
||||||
&rect);
|
|
||||||
|
|
||||||
wx = rect.x;
|
wx = rect.x;
|
||||||
wy = rect.y;
|
wy = rect.y;
|
||||||
|
@ -561,29 +525,20 @@ show_popup_menu (XedDocumentsPanel *panel,
|
||||||
{
|
{
|
||||||
GtkWidget *menu;
|
GtkWidget *menu;
|
||||||
|
|
||||||
menu = gtk_ui_manager_get_widget (xed_window_get_ui_manager (panel->priv->window),
|
menu = gtk_ui_manager_get_widget (xed_window_get_ui_manager (panel->priv->window), "/NotebookPopup");
|
||||||
"/NotebookPopup");
|
|
||||||
g_return_val_if_fail (menu != NULL, FALSE);
|
g_return_val_if_fail (menu != NULL, FALSE);
|
||||||
|
|
||||||
if (event != NULL)
|
if (event != NULL)
|
||||||
{
|
{
|
||||||
gtk_menu_popup (GTK_MENU (menu),
|
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
|
||||||
NULL,
|
NULL, NULL,
|
||||||
NULL,
|
event->button, event->time);
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
event->button,
|
|
||||||
event->time);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_menu_popup (GTK_MENU (menu),
|
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
|
||||||
NULL,
|
(GtkMenuPositionFunc) menu_position, panel,
|
||||||
NULL,
|
0, gtk_get_current_event_time ());
|
||||||
(GtkMenuPositionFunc) menu_position,
|
|
||||||
panel,
|
|
||||||
0,
|
|
||||||
gtk_get_current_event_time ());
|
|
||||||
|
|
||||||
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
|
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
|
||||||
}
|
}
|
||||||
|
@ -604,18 +559,12 @@ panel_button_press_event (GtkTreeView *treeview,
|
||||||
{
|
{
|
||||||
/* Change the cursor position */
|
/* Change the cursor position */
|
||||||
if (gtk_tree_view_get_path_at_pos (treeview,
|
if (gtk_tree_view_get_path_at_pos (treeview,
|
||||||
event->x,
|
event->x, event->y,
|
||||||
event->y,
|
&path, NULL,
|
||||||
&path,
|
NULL, NULL))
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL))
|
|
||||||
{
|
{
|
||||||
|
|
||||||
gtk_tree_view_set_cursor (treeview,
|
gtk_tree_view_set_cursor (treeview, path, NULL, FALSE);
|
||||||
path,
|
|
||||||
NULL,
|
|
||||||
FALSE);
|
|
||||||
|
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (path);
|
||||||
|
|
||||||
|
@ -669,25 +618,19 @@ treeview_query_tooltip (GtkWidget *widget,
|
||||||
{
|
{
|
||||||
gint bin_x, bin_y;
|
gint bin_x, bin_y;
|
||||||
|
|
||||||
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view,
|
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y, &bin_x, &bin_y);
|
||||||
x, y,
|
|
||||||
&bin_x, &bin_y);
|
|
||||||
|
|
||||||
if (!gtk_tree_view_get_path_at_pos (tree_view,
|
if (!gtk_tree_view_get_path_at_pos (tree_view,
|
||||||
bin_x, bin_y,
|
bin_x, bin_y,
|
||||||
&path,
|
&path, NULL,
|
||||||
NULL, NULL, NULL))
|
NULL, NULL))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_tree_model_get_iter (model, &iter, path);
|
gtk_tree_model_get_iter (model, &iter, path);
|
||||||
gtk_tree_model_get (model,
|
gtk_tree_model_get (model, &iter, TAB_COLUMN, &tab, -1);
|
||||||
&iter,
|
|
||||||
TAB_COLUMN,
|
|
||||||
&tab,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
tip = _xed_tab_get_tooltips (XED_TAB (tab));
|
tip = _xed_tab_get_tooltips (XED_TAB (tab));
|
||||||
gtk_tooltip_set_markup (tooltip, tip);
|
gtk_tooltip_set_markup (tooltip, tip);
|
||||||
|
@ -711,7 +654,9 @@ treeview_row_inserted (GtkTreeModel *tree_model,
|
||||||
gint new_position;
|
gint new_position;
|
||||||
|
|
||||||
if (panel->priv->adding_tab)
|
if (panel->priv->adding_tab)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tab = xed_window_get_active_tab (panel->priv->window);
|
tab = xed_window_get_active_tab (panel->priv->window);
|
||||||
g_return_if_fail (tab != NULL);
|
g_return_if_fail (tab != NULL);
|
||||||
|
@ -725,14 +670,13 @@ treeview_row_inserted (GtkTreeModel *tree_model,
|
||||||
nb = _xed_window_get_notebook (panel->priv->window);
|
nb = _xed_window_get_notebook (panel->priv->window);
|
||||||
|
|
||||||
new_position = indeces[0];
|
new_position = indeces[0];
|
||||||
old_position = gtk_notebook_page_num (GTK_NOTEBOOK (nb),
|
old_position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
|
||||||
GTK_WIDGET (tab));
|
|
||||||
if (new_position > old_position)
|
if (new_position > old_position)
|
||||||
|
{
|
||||||
new_position = MAX (0, new_position - 1);
|
new_position = MAX (0, new_position - 1);
|
||||||
|
}
|
||||||
|
|
||||||
xed_notebook_reorder_tab (XED_NOTEBOOK (nb),
|
xed_notebook_reorder_tab (XED_NOTEBOOK (nb), tab, new_position);
|
||||||
tab,
|
|
||||||
new_position);
|
|
||||||
|
|
||||||
panel->priv->is_reodering = FALSE;
|
panel->priv->is_reodering = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -750,16 +694,13 @@ xed_documents_panel_init (XedDocumentsPanel *panel)
|
||||||
panel->priv->adding_tab = FALSE;
|
panel->priv->adding_tab = FALSE;
|
||||||
panel->priv->is_reodering = FALSE;
|
panel->priv->is_reodering = FALSE;
|
||||||
|
|
||||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (panel), GTK_ORIENTATION_VERTICAL);
|
||||||
GTK_ORIENTATION_VERTICAL);
|
|
||||||
|
|
||||||
/* Create the scrolled window */
|
/* Create the scrolled window */
|
||||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||||
g_return_if_fail (sw != NULL);
|
g_return_if_fail (sw != NULL);
|
||||||
|
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
GTK_POLICY_AUTOMATIC,
|
|
||||||
GTK_POLICY_AUTOMATIC);
|
|
||||||
gtk_widget_show (sw);
|
gtk_widget_show (sw);
|
||||||
gtk_box_pack_start (GTK_BOX (panel), sw, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (panel), sw, TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
@ -790,35 +731,17 @@ xed_documents_panel_init (XedDocumentsPanel *panel)
|
||||||
gtk_tree_view_column_pack_start (column, cell, TRUE);
|
gtk_tree_view_column_pack_start (column, cell, TRUE);
|
||||||
gtk_tree_view_column_add_attribute (column, cell, "markup", NAME_COLUMN);
|
gtk_tree_view_column_add_attribute (column, cell, "markup", NAME_COLUMN);
|
||||||
|
|
||||||
gtk_tree_view_append_column (GTK_TREE_VIEW (panel->priv->treeview),
|
gtk_tree_view_append_column (GTK_TREE_VIEW (panel->priv->treeview), column);
|
||||||
column);
|
|
||||||
|
|
||||||
selection = gtk_tree_view_get_selection (
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (panel->priv->treeview));
|
||||||
GTK_TREE_VIEW (panel->priv->treeview));
|
|
||||||
|
|
||||||
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
|
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
|
||||||
|
|
||||||
g_signal_connect (panel->priv->treeview,
|
g_signal_connect (panel->priv->treeview, "cursor_changed", G_CALLBACK (treeview_cursor_changed), panel);
|
||||||
"cursor_changed",
|
g_signal_connect (panel->priv->treeview, "button-press-event", G_CALLBACK (panel_button_press_event), panel);
|
||||||
G_CALLBACK (treeview_cursor_changed),
|
g_signal_connect (panel->priv->treeview, "popup-menu", G_CALLBACK (panel_popup_menu), panel);
|
||||||
panel);
|
g_signal_connect (panel->priv->treeview, "query-tooltip", G_CALLBACK (treeview_query_tooltip), NULL);
|
||||||
g_signal_connect (panel->priv->treeview,
|
g_signal_connect (panel->priv->model, "row-inserted", G_CALLBACK (treeview_row_inserted), panel);
|
||||||
"button-press-event",
|
|
||||||
G_CALLBACK (panel_button_press_event),
|
|
||||||
panel);
|
|
||||||
g_signal_connect (panel->priv->treeview,
|
|
||||||
"popup-menu",
|
|
||||||
G_CALLBACK (panel_popup_menu),
|
|
||||||
panel);
|
|
||||||
g_signal_connect (panel->priv->treeview,
|
|
||||||
"query-tooltip",
|
|
||||||
G_CALLBACK (treeview_query_tooltip),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
g_signal_connect (panel->priv->model,
|
|
||||||
"row-inserted",
|
|
||||||
G_CALLBACK (treeview_row_inserted),
|
|
||||||
panel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
|
|
Loading…
Reference in New Issue