Skip to content

Commit

Permalink
added pane_notify_selection to pane API
Browse files Browse the repository at this point in the history
  • Loading branch information
nadvornik committed Apr 6, 2009
1 parent 3b39f3a commit 61856b1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
19 changes: 18 additions & 1 deletion src/bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ static gboolean bar_menu_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer
}


void bar_pane_set_fd_cb(GtkWidget *expander, gpointer data)
static void bar_pane_set_fd_cb(GtkWidget *expander, gpointer data)
{
GtkWidget *widget = gtk_bin_get_child(GTK_BIN(expander));
PaneData *pd = g_object_get_data(G_OBJECT(widget), "pane_data");
Expand All @@ -327,6 +327,23 @@ void bar_set_fd(GtkWidget *bar, FileData *fd)

}

static void bar_pane_notify_selection_cb(GtkWidget *expander, gpointer data)
{
GtkWidget *widget = gtk_bin_get_child(GTK_BIN(expander));
PaneData *pd = g_object_get_data(G_OBJECT(widget), "pane_data");
if (!pd) return;
if (pd->pane_notify_selection) pd->pane_notify_selection(widget, GPOINTER_TO_INT(data));
}

void bar_notify_selection(GtkWidget *bar, gint count)
{
BarData *bd;
bd = g_object_get_data(G_OBJECT(bar), "bar_data");
if (!bd) return;

gtk_container_foreach(GTK_CONTAINER(bd->vbox), bar_pane_notify_selection_cb, GINT_TO_POINTER(count));
}

gboolean bar_event(GtkWidget *bar, GdkEvent *event)
{
BarData *bd;
Expand Down
2 changes: 2 additions & 0 deletions src/bar.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ typedef struct _PaneData PaneData;
struct _PaneData {
/* filled in by pane */
void (*pane_set_fd)(GtkWidget *pane, FileData *fd);
void (*pane_notify_selection)(GtkWidget *pane, gint count);
gint (*pane_event)(GtkWidget *pane, GdkEvent *event);
void (*pane_write_config)(GtkWidget *pane, GString *outstr, gint indent);
GtkWidget *title;
Expand Down Expand Up @@ -58,6 +59,7 @@ GtkWidget *bar_find_pane_by_id(GtkWidget *bar, PaneType type, const gchar *id);
void bar_clear(GtkWidget *bar);

void bar_set_fd(GtkWidget *bar, FileData *fd);
void bar_notify_selection(GtkWidget *bar, gint count);
gboolean bar_event(GtkWidget *bar, GdkEvent *event);

gint bar_get_width(GtkWidget *bar);
Expand Down
2 changes: 1 addition & 1 deletion src/layout_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2063,7 +2063,7 @@ static void layout_bar_new_selection(LayoutWindow *lw, gint count)
{
if (!layout_bar_enabled(lw)) return;

// bar_info_selection(lw->bar_info, count - 1);
bar_notify_selection(lw->bar, count);
}

static gboolean layout_bar_sort_enabled(LayoutWindow *lw)
Expand Down

0 comments on commit 61856b1

Please sign in to comment.