Changeset 99207 in webkit
- Timestamp:
- Nov 3, 2011 10:06:51 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r99206 r99207 1 2011-11-03 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Show url of history items in a status bar in MiniBrowser 4 https://bugs.webkit.org/show_bug.cgi?id=71474 5 6 Reviewed by Martin Robinson. 7 8 * MiniBrowser/gtk/BrowserWindow.c: 9 (browserWindowSetStatusText): Set status text and show/hide the 10 status label. 11 (resetStatusText): Reset status text when history menu is hidden. 12 (browserWindowHistoryItemSelected): Show url of currently selected 13 history item. 14 (browserWindowCreateBackForwardMenu): Connect to hide signal of 15 menu to reset the status text. 16 (browserWindowConstructed): Use GtkOverlay if available to show 17 status text. 18 1 19 2011-11-03 Carlos Garcia Campos <cgarcia@igalia.com> 2 20 -
trunk/Tools/MiniBrowser/gtk/BrowserWindow.c
r99206 r99207 41 41 GtkWidget *backItem; 42 42 GtkWidget *forwardItem; 43 GtkWidget *statusLabel; 43 44 WebKitWebView *webView; 44 45 … … 52 53 53 54 G_DEFINE_TYPE(BrowserWindow, browser_window, GTK_TYPE_WINDOW) 55 56 static void browserWindowSetStatusText(BrowserWindow *window, const char *text) 57 { 58 #if GTK_CHECK_VERSION(3, 2, 0) 59 gtk_label_set_text(GTK_LABEL(window->statusLabel), text); 60 gtk_widget_set_visible(window->statusLabel, !!text); 61 #endif 62 } 63 64 static void resetStatusText(GtkWidget *widget, BrowserWindow *window) 65 { 66 browserWindowSetStatusText(window, NULL); 67 } 54 68 55 69 static void activateUriEntryCallback(BrowserWindow *window) … … 85 99 if (progress == 1.0) 86 100 g_timeout_add(500, (GSourceFunc)resetEntryProgress, window->uriEntry); 101 } 102 103 static void browserWindowHistoryItemSelected(BrowserWindow *window, GtkMenuItem *item) 104 { 105 GtkAction *action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(item)); 106 browserWindowSetStatusText(window, action ? gtk_action_get_name(action) : NULL); 87 107 } 88 108 … … 113 133 114 134 GtkWidget *menuItem = gtk_action_create_menu_item(action); 135 g_signal_connect_swapped(menuItem, "select", G_CALLBACK(browserWindowHistoryItemSelected), window); 115 136 g_object_unref(action); 116 137 … … 118 139 gtk_widget_show(menuItem); 119 140 } 141 142 /* FIXME: This shoulnd't be necessary when didMouseMoveOverElement 143 * is implemented in WebKit2 GTK+ API. 144 */ 145 g_signal_connect(menu, "hide", G_CALLBACK(resetStatusText), window); 120 146 121 147 return menu; … … 235 261 g_signal_connect(backForwadlist, "changed", G_CALLBACK(backForwadlistChanged), window); 236 262 263 #if GTK_CHECK_VERSION(3, 2, 0) 264 GtkWidget *overlay = gtk_overlay_new(); 265 gtk_box_pack_start(GTK_BOX(window->mainBox), overlay, TRUE, TRUE, 0); 266 gtk_widget_show(overlay); 267 268 window->statusLabel = gtk_label_new(NULL); 269 gtk_widget_set_halign(window->statusLabel, GTK_ALIGN_START); 270 gtk_widget_set_valign(window->statusLabel, GTK_ALIGN_END); 271 gtk_widget_set_margin_left(window->statusLabel, 1); 272 gtk_widget_set_margin_right(window->statusLabel, 1); 273 gtk_widget_set_margin_top(window->statusLabel, 1); 274 gtk_widget_set_margin_bottom(window->statusLabel, 1); 275 gtk_overlay_add_overlay(GTK_OVERLAY(overlay), window->statusLabel); 276 277 gtk_container_add(GTK_CONTAINER(overlay), GTK_WIDGET(window->webView)); 278 #else 237 279 gtk_box_pack_start(GTK_BOX(window->mainBox), GTK_WIDGET(window->webView), TRUE, TRUE, 0); 280 #endif 238 281 gtk_widget_show(GTK_WIDGET(window->webView)); 239 282 }
Note: See TracChangeset
for help on using the changeset viewer.