static VALUE rg_set_scroll_adjustments(VALUE self, VALUE h, VALUE v) { return CBOOL2RVAL(gtk_widget_set_scroll_adjustments(_SELF(self), GTK_ADJUSTMENT(_SELF(h)), GTK_ADJUSTMENT(_SELF(v)))); }
void cmd_scrollbars_visibility() { if(uzbl.gui.scrollbars_visible) { uzbl.gui.bar_h = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (uzbl.gui.scrolled_win)); uzbl.gui.bar_v = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (uzbl.gui.scrolled_win)); } else { uzbl.gui.bar_v = gtk_range_get_adjustment (GTK_RANGE (uzbl.gui.scbar_v)); uzbl.gui.bar_h = gtk_range_get_adjustment (GTK_RANGE (uzbl.gui.scbar_h)); } gtk_widget_set_scroll_adjustments (GTK_WIDGET (uzbl.gui.web_view), uzbl.gui.bar_h, uzbl.gui.bar_v); }
/* Sets vertical and horizontal adjustments */ int clip_GTK_WIDGETSETSCROLLADJUSTMENTS(ClipMachine * cm) { C_widget *cwid = _fetch_cw_arg(cm); C_widget *chadj = _fetch_cwidget(cm, _clip_spar(cm,2)); C_widget *cvadj = _fetch_cwidget(cm, _clip_spar(cm,3)); CHECKCWID(cwid,GTK_IS_WIDGET); CHECKOPT2(2,NUMERIC_t,MAP_t); CHECKCWIDOPT(chadj,GTK_IS_ADJUSTMENT); CHECKOPT2(3,NUMERIC_t,MAP_t); CHECKCWIDOPT(cvadj,GTK_IS_ADJUSTMENT); _clip_retl(cm, gtk_widget_set_scroll_adjustments(cwid->widget, GTK_ADJUSTMENT(chadj->widget),GTK_ADJUSTMENT(cvadj->widget))); return 0; err: return 1; }
static void uni_scroll_win_set_view (UniScrollWin * window, UniImageView * view) { // Setup the scrollbars GtkAdjustment *hadj; hadj = (GtkAdjustment *) g_object_new (GTK_TYPE_ADJUSTMENT, NULL); GtkAdjustment *vadj; vadj = (GtkAdjustment *) g_object_new (GTK_TYPE_ADJUSTMENT, NULL); window->hscroll = gtk_hscrollbar_new (hadj); window->vscroll = gtk_vscrollbar_new (vadj); // We want to be notified when the adjustments change. g_signal_connect (hadj, "changed", G_CALLBACK (uni_scroll_win_adjustment_changed), window); g_signal_connect (vadj, "changed", G_CALLBACK (uni_scroll_win_adjustment_changed), window); // Output the adjustments to the widget. gtk_widget_set_scroll_adjustments (GTK_WIDGET (view), hadj, vadj); // Add the widgets to the table. gtk_widget_push_composite_child (); gtk_table_attach (GTK_TABLE (window), GTK_WIDGET (view), 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_table_attach (GTK_TABLE (window), window->vscroll, 1, 2, 0, 1, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_table_attach (GTK_TABLE (window), window->hscroll, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach (GTK_TABLE (window), window->nav_box, 1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); gtk_widget_pop_composite_child (); // Create the UniNav popup. window->nav = uni_nav_new (view); }
int main (int argc, char* argv[]) { gtk_init (&argc, &argv); if (!g_thread_supported ()) g_thread_init (NULL); printf("Uzbl start location: %s\n", argv[0]); strcpy(executable_path,argv[0]); strcat ((char *) XDG_CONFIG_HOME_default, getenv ("HOME")); strcat ((char *) XDG_CONFIG_HOME_default, "/.config"); GError *error = NULL; GOptionContext* context = g_option_context_new ("- some stuff here maybe someday"); g_option_context_add_main_entries (context, entries, NULL); g_option_context_add_group (context, gtk_get_option_group (TRUE)); g_option_context_parse (context, &argc, &argv, &error); /* initialize hash table */ bindings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, free_action); soup_session = webkit_get_default_session(); keycmd = g_string_new(""); settings_init (); commands_hash (); if (always_insert_mode) insert_mode = TRUE; GtkWidget* vbox = gtk_vbox_new (FALSE, 0); if (status_top) gtk_box_pack_start (GTK_BOX (vbox), create_mainbar (), FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), create_browser (), TRUE, TRUE, 0); if (!status_top) gtk_box_pack_start (GTK_BOX (vbox), create_mainbar (), FALSE, TRUE, 0); main_window = create_window (); gtk_container_add (GTK_CONTAINER (main_window), vbox); load_uri (web_view, uri); gtk_widget_grab_focus (GTK_WIDGET (web_view)); gtk_widget_show_all (main_window); xwin = GDK_WINDOW_XID (GTK_WIDGET (main_window)->window); printf("window_id %i\n",(int) xwin); printf("pid %i\n", getpid ()); printf("name: %s\n", instance_name); scbar_v = (GtkScrollbar*) gtk_vscrollbar_new (NULL); bar_v = gtk_range_get_adjustment((GtkRange*) scbar_v); scbar_h = (GtkScrollbar*) gtk_hscrollbar_new (NULL); bar_h = gtk_range_get_adjustment((GtkRange*) scbar_h); gtk_widget_set_scroll_adjustments ((GtkWidget*) web_view, bar_h, bar_v); if (!show_status) gtk_widget_hide(mainbar); if (fifo_dir) create_fifo (); if (socket_dir) create_socket(); gtk_main (); g_string_free(keycmd, TRUE); if (fifo_dir) unlink (fifo_path); if (socket_dir) unlink (socket_path); g_hash_table_destroy(bindings); g_hash_table_destroy(commands); return 0; }