View Single Post
Old 06-29-2009, 08:13 AM   #81
ericshliao
Guru
ericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enough
 
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
hansel,
I am suffering a HDD failure, while waiting for rescuing back the data, I spent some time to implement a clickable titlebar on newlister.
I would like to ask you do me a favor. If not bothering, please help me check if my mod does work. Thanx.

The idea is simple. The top-most black bar is composed by two GtkLabel widgets: titleItem (on the left) and titleLocation (on the right). The following code makes them responsive to button-click events. If clicking on titleItem, call the same function just as MODE button pushed. If clicking on titleLocation, call the same function just as GO-UP button pushed.

Code:
g_signal_connect(G_OBJECT((g_lister.titleItem), "button_press_event",
  G_CALLBACK(ls_titleItem_press_event), data);
In "lister.cpp", add the above code right before "gtk_widget_show(g_lister.titleItem);".
Code:
g_signal_connect(G_OBJECT((g_lister.titleLocation), "button_press_event",
  G_CALLBACK(ls_titleLocation_press_event), data);
In "lister.cpp", Add the above code right before "gtk_widget_show(g_lister.titleLocation);".

Code:
void ls_titleItem_press_event(GtkWidget * widget, GdkEventButton * event, gpointer data)
{
  ctrl_mode_button_clicked();
}


void ls_titleLocation_press_event(GtkWidget * widget, GdkEventButton * event, gpointer data)
{
	GdkEvent *keyevent;
	keyevent = gdk_event_new(GDK_F5);
	((GdkEventKey *)keyevent)->keyval = GDK_F5;
	ctrl_listerArea_keypress(widget, keyPressCbk(window, (GdkEventKey *)keyevent, data);
	gdk_event_free(keyevent);
}
In "lister.cpp", add the above two function.

Last edited by ericshliao; 06-29-2009 at 12:33 PM.
ericshliao is offline   Reply With Quote