Permalink
Browse files

Use new LUAKIT_WIDGET_SIGNAL_COMMON macro for focus/parent-set sigs

  • Loading branch information...
mason-larobina committed Mar 5, 2012
1 parent 8ab28ee commit f1cf94965a245d4466dd99ef97f44cc1333ae53b
Showing with 11 additions and 14 deletions.
  1. +5 −0 widgets/common.h
  2. +1 −3 widgets/entry.c
  3. +1 −3 widgets/label.c
  4. +1 −3 widgets/notebook.c
  5. +1 −0 widgets/socket.c
  6. +1 −3 widgets/webview.c
  7. +1 −2 widgets/window.c
View
@@ -59,6 +59,11 @@
case L_TK_CHILDREN: \
return luaH_widget_get_children(L, widget);
+#define LUAKIT_WIDGET_SIGNAL_COMMON(w) \
+ "signal::focus-in-event", G_CALLBACK(focus_cb), w, \
+ "signal::focus-out-event", G_CALLBACK(focus_cb), w, \
+ "signal::parent-set", G_CALLBACK(parent_set_cb), w,
+
gboolean button_cb(GtkWidget*, GdkEventButton*, widget_t*);
gboolean focus_cb(GtkWidget*, GdkEventFocus*, widget_t*);
gboolean key_press_cb(GtkWidget*, GdkEventKey*, widget_t*);
View
@@ -175,11 +175,9 @@ widget_entry(widget_t *w, luakit_token_t UNUSED(token))
gtk_entry_set_inner_border(GTK_ENTRY(w->widget), NULL);
g_object_connect(G_OBJECT(w->widget),
+ LUAKIT_WIDGET_SIGNAL_COMMON(w)
"signal::activate", G_CALLBACK(activate_cb), w,
- "signal::focus-in-event", G_CALLBACK(focus_cb), w,
- "signal::focus-out-event", G_CALLBACK(focus_cb), w,
"signal::key-press-event", G_CALLBACK(key_press_cb), w,
- "signal::parent-set", G_CALLBACK(parent_set_cb), w,
"signal::notify::cursor-position", G_CALLBACK(position_cb), w,
// The following signals replace the old "signal::changed", since that
// does not allow for the selection to be changed in it's callback.
View
@@ -205,10 +205,8 @@ widget_label(widget_t *w, luakit_token_t UNUSED(token))
gtk_misc_set_padding(GTK_MISC(w->widget), 2, 2);
g_object_connect(G_OBJECT(w->widget),
- "signal::focus-in-event", G_CALLBACK(focus_cb), w,
- "signal::focus-out-event", G_CALLBACK(focus_cb), w,
+ LUAKIT_WIDGET_SIGNAL_COMMON(w)
"signal::key-press-event", G_CALLBACK(key_press_cb), w,
- "signal::parent-set", G_CALLBACK(parent_set_cb), w,
NULL);
gtk_widget_show(w->widget);
View
@@ -284,13 +284,11 @@ widget_notebook(widget_t *w, luakit_token_t UNUSED(token))
gtk_notebook_set_scrollable(GTK_NOTEBOOK(w->widget), TRUE);
g_object_connect(G_OBJECT(w->widget),
- "signal::focus-in-event", G_CALLBACK(focus_cb), w,
- "signal::focus-out-event", G_CALLBACK(focus_cb), w,
+ LUAKIT_WIDGET_SIGNAL_COMMON(w)
"signal::key-press-event", G_CALLBACK(key_press_cb), w,
"signal::page-added", G_CALLBACK(page_added_cb), w,
"signal::page-removed", G_CALLBACK(page_removed_cb), w,
"signal::page-reordered", G_CALLBACK(reorder_cb), w,
- "signal::parent-set", G_CALLBACK(parent_set_cb), w,
"signal::switch-page", G_CALLBACK(switch_cb), w,
NULL);
View
@@ -89,6 +89,7 @@ widget_socket(widget_t *w, luakit_token_t UNUSED(token))
g_object_set_data(G_OBJECT(w->widget), "lua_widget", (gpointer) w);
gtk_widget_show(w->widget);
g_object_connect(G_OBJECT(w->widget),
+ LUAKIT_WIDGET_SIGNAL_COMMON(w)
"signal::plug-added", G_CALLBACK(plug_added_cb), w,
"signal::plug-removed", G_CALLBACK(plug_removed_cb), w,
NULL);
View
@@ -830,22 +830,20 @@ widget_webview(widget_t *w, luakit_token_t UNUSED(token))
/* connect webview signals */
g_object_connect(G_OBJECT(d->view),
+ LUAKIT_WIDGET_SIGNAL_COMMON(w)
"signal::button-press-event", G_CALLBACK(webview_button_cb), w,
"signal::button-release-event", G_CALLBACK(webview_button_cb), w,
"signal::create-web-view", G_CALLBACK(create_web_view_cb), w,
"signal::document-load-finished", G_CALLBACK(document_load_finished_cb), w,
"signal::download-requested", G_CALLBACK(download_request_cb), w,
"signal::expose-event", G_CALLBACK(expose_cb), w,
- "signal::focus-in-event", G_CALLBACK(focus_cb), w,
- "signal::focus-out-event", G_CALLBACK(focus_cb), w,
"signal::hovering-over-link", G_CALLBACK(link_hover_cb), w,
"signal::key-press-event", G_CALLBACK(key_press_cb), w,
"signal::mime-type-policy-decision-requested", G_CALLBACK(mime_type_decision_cb), w,
"signal::navigation-policy-decision-requested", G_CALLBACK(navigation_decision_cb), w,
"signal::new-window-policy-decision-requested", G_CALLBACK(new_window_decision_cb), w,
"signal::notify", G_CALLBACK(notify_cb), w,
"signal::notify::load-status", G_CALLBACK(notify_load_status_cb), w,
- "signal::parent-set", G_CALLBACK(parent_set_cb), w,
"signal::populate-popup", G_CALLBACK(populate_popup_cb), w,
"signal::resource-request-starting", G_CALLBACK(resource_request_starting_cb), w,
"signal::scroll-event", G_CALLBACK(scroll_event_cb), w,
View
@@ -203,10 +203,9 @@ widget_window(widget_t *w, luakit_token_t UNUSED(token))
gtk_window_set_geometry_hints(d->win, NULL, &hints, GDK_HINT_MIN_SIZE);
g_object_connect(G_OBJECT(w->widget),
+ LUAKIT_WIDGET_SIGNAL_COMMON(w)
"signal::add", G_CALLBACK(add_cb), w,
"signal::destroy", G_CALLBACK(destroy_cb), w,
- "signal::focus-in-event", G_CALLBACK(focus_cb), w,
- "signal::focus-out-event", G_CALLBACK(focus_cb), w,
"signal::key-press-event", G_CALLBACK(key_press_cb), w,
"signal::remove", G_CALLBACK(remove_cb), w,
"signal::window-state-event", G_CALLBACK(window_state_cb), w,

0 comments on commit f1cf949

Please sign in to comment.