static void set_adjustment_to_fraction (GtkAdjustment *adjustment, gdouble fraction) { gdouble upper = gtk_adjustment_get_upper (adjustment); gdouble lower = gtk_adjustment_get_lower (adjustment); gdouble page_size = gtk_adjustment_get_page_size (adjustment); gtk_adjustment_set_value (adjustment, (1 - fraction) * lower + fraction * (upper - page_size)); }
void scroll(Client *c, const Arg *arg) { gdouble v; GtkAdjustment *a; a = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(c->scroll)); v = gtk_adjustment_get_value(a); v += gtk_adjustment_get_step_increment(a) * arg->i; v = MAX(v, 0.0); v = MIN(v, gtk_adjustment_get_upper(a) - gtk_adjustment_get_page_size(a)); gtk_adjustment_set_value(a, v); }
void app_resizer_set_vadjustment_value (GtkWidget * widget, gdouble value) { GtkAdjustment *adjust = gtk_layout_get_vadjustment (GTK_LAYOUT (widget)); gdouble upper = gtk_adjustment_get_upper (adjust); gdouble page_size = gtk_adjustment_get_page_size (adjust); if (value > upper - page_size) { value = upper - page_size; } gtk_adjustment_set_value (adjust, value); }
static gboolean begin_scroll (gpointer data) { GtkAdjustment *adj = gtk_scrollable_get_vadjustment (data); gdouble value = gtk_adjustment_get_upper (adj); gb_object_animate(adj, GB_ANIMATION_EASE_IN_OUT_QUAD, 5000, "value", value / 2.0, NULL); return G_SOURCE_REMOVE; }
void AP_UnixFrame::setXScrollRange(void) { AP_UnixFrameImpl * pFrameImpl = static_cast<AP_UnixFrameImpl *>(getFrameImpl()); UT_return_if_fail(pFrameImpl); GR_Graphics * pGr = pFrameImpl->getFrame ()->getCurrentView ()->getGraphics (); int width = 0; if(m_pData) //this isn't guaranteed in AbiCommand width = static_cast<AP_FrameData*>(m_pData)->m_pDocLayout->getWidth(); int windowWidth = 0; GtkAllocation allocation; gtk_widget_get_allocation(GTK_WIDGET(pFrameImpl->m_dArea),&allocation); if(pFrameImpl->m_dArea) //this isn't guaranteed in AbiCommand windowWidth = static_cast<int>(pGr->tluD (allocation.width)); int newvalue = ((m_pView) ? m_pView->getXScrollOffset() : 0); int newmax = width - windowWidth; /* upper - page_size */ if (newmax <= 0) newvalue = 0; else if (newvalue > newmax) newvalue = newmax; bool bDifferentPosition = false; bool bDifferentLimits = false; if(pFrameImpl->m_pHadj) //this isn't guaranteed in AbiCommand { bDifferentPosition = (newvalue != gtk_adjustment_get_value(pFrameImpl->m_pHadj)); bDifferentLimits = ((width-windowWidth) != gtk_adjustment_get_upper(pFrameImpl->m_pHadj)- gtk_adjustment_get_page_size(pFrameImpl->m_pHadj)); } pFrameImpl->_setScrollRange(apufi_scrollX, newvalue, static_cast<gfloat>(width), static_cast<gfloat>(windowWidth)); if (m_pView && (bDifferentPosition || bDifferentLimits)) m_pView->sendHorizontalScrollEvent(newvalue, static_cast<UT_sint32> (gtk_adjustment_get_upper(pFrameImpl->m_pHadj)- gtk_adjustment_get_page_size(pFrameImpl->m_pHadj))); }
static gboolean eog_thumb_nav_scroll_event (GtkWidget *widget, GdkEventScroll *event, gpointer user_data) { EogThumbNav *nav = EOG_THUMB_NAV (user_data); gint inc = EOG_THUMB_NAV_SCROLL_INC * 3; gdouble value, upper, page_size, delta_x, delta_y; gboolean smooth; nav->priv->adj = nav->priv->vertical ? nav->priv->vadj : nav->priv->hadj; switch (event->direction) { #if GTK_CHECK_VERSION (3, 3, 18) /* Handle smooth scroll events from mouse wheels, bug 672311. */ case GDK_SCROLL_SMOOTH: smooth = gdk_event_get_scroll_deltas ((const GdkEvent *) event, &delta_x, &delta_y); /* Pass through non-mouse wheel events. */ if (G_UNLIKELY (!smooth) || delta_x != 0.0 || fabs (delta_y) != 1.0) return FALSE; inc *= (gint) delta_y; break; #endif case GDK_SCROLL_UP: case GDK_SCROLL_LEFT: inc *= -1; break; case GDK_SCROLL_DOWN: case GDK_SCROLL_RIGHT: break; default: g_assert_not_reached (); return FALSE; } value = gtk_adjustment_get_value (nav->priv->adj); if (inc < 0) gtk_adjustment_set_value (nav->priv->adj, MAX (0, value + inc)); else { upper = gtk_adjustment_get_upper (nav->priv->adj); page_size = gtk_adjustment_get_page_size (nav->priv->adj); gtk_adjustment_set_value (nav->priv->adj, MIN (upper - page_size, value + inc)); } gtk_adjustment_value_changed (nav->priv->adj); return TRUE; }
gboolean gtk_vscrollbutton_scroll(GtkVScrollbutton *scrollbutton) { gfloat bound; gfloat new_value; gfloat page_size; gfloat value; gboolean return_val; cm_return_val_if_fail(scrollbutton != NULL, FALSE); cm_return_val_if_fail(GTK_IS_VSCROLLBUTTON(scrollbutton), FALSE); new_value = value = gtk_adjustment_get_value(scrollbutton->adjustment); return_val = TRUE; switch (scrollbutton->scroll_type) { case GTK_SCROLL_STEP_BACKWARD: new_value = value - gtk_adjustment_get_step_increment(scrollbutton->adjustment); bound = gtk_adjustment_get_lower(scrollbutton->adjustment); if (new_value <= bound) { new_value = bound; return_val = FALSE; scrollbutton->timer = 0; } break; case GTK_SCROLL_STEP_FORWARD: new_value = value + gtk_adjustment_get_step_increment(scrollbutton->adjustment); bound = gtk_adjustment_get_upper(scrollbutton->adjustment); page_size = gtk_adjustment_get_page_size(scrollbutton->adjustment); if (new_value >= (bound - page_size)) { new_value = bound - page_size; return_val = FALSE; scrollbutton->timer = 0; } break; default: break; } if (new_value != value) { gtk_adjustment_set_value(scrollbutton->adjustment, new_value); g_signal_emit_by_name(G_OBJECT (scrollbutton->adjustment), "value_changed"); gtk_widget_queue_resize(GTK_WIDGET(scrollbutton)); /* ensure resize */ } return return_val; }
GtkAdjustment* zathura_adjustment_clone(GtkAdjustment* adjustment) { gdouble value = gtk_adjustment_get_value(adjustment); gdouble lower = gtk_adjustment_get_lower(adjustment); gdouble upper = gtk_adjustment_get_upper(adjustment); gdouble step_increment = gtk_adjustment_get_step_increment(adjustment); gdouble page_increment = gtk_adjustment_get_page_increment(adjustment); gdouble page_size = gtk_adjustment_get_page_size(adjustment); return GTK_ADJUSTMENT(gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size)); }
static gboolean eog_thumb_nav_scroll_step (gpointer user_data) { EogThumbNav *nav = EOG_THUMB_NAV (user_data); GtkAdjustment *adj = nav->priv->adj; gint delta; if (nav->priv->scroll_pos < 10) delta = EOG_THUMB_NAV_SCROLL_INC; else if (nav->priv->scroll_pos < 20) delta = EOG_THUMB_NAV_SCROLL_INC * 2; else if (nav->priv->scroll_pos < 30) delta = EOG_THUMB_NAV_SCROLL_INC * 2 + 5; else delta = EOG_THUMB_NAV_SCROLL_INC * 2 + 12; if (!nav->priv->scroll_dir) delta *= -1; if ((gint) (gtk_adjustment_get_value (adj) + (gdouble) delta) >= 0 && (gint) (gtk_adjustment_get_value (adj) + (gdouble) delta) <= gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj)) { gtk_adjustment_set_value(adj, gtk_adjustment_get_value (adj) + (gdouble) delta); nav->priv->scroll_pos++; } else { if (delta > 0) gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj)); else gtk_adjustment_set_value (adj, 0); nav->priv->scroll_pos = 0; return FALSE; } return TRUE; }
static void gtk_vscrollbutton_set_sensitivity (GtkAdjustment *adjustment, GtkVScrollbutton *scrollbutton) { gfloat value; if (!gtk_widget_get_realized(GTK_WIDGET(scrollbutton))) return; if (scrollbutton->button != 0) return; /* not while something is pressed */ value = gtk_adjustment_get_value(adjustment); gtk_widget_set_sensitive(scrollbutton->upbutton, (value > gtk_adjustment_get_lower(adjustment))); gtk_widget_set_sensitive(scrollbutton->downbutton, (value < (gtk_adjustment_get_upper(adjustment) - gtk_adjustment_get_page_size(adjustment)))); }
void MainWindow::log(const char* msg){ GtkTextBuffer *buffer; GtkTextIter end; buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(_log)); gtk_text_buffer_get_end_iter (buffer, &end); gtk_text_buffer_insert (buffer, &end, msg, -1); // Scroll para o final do Textview GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW(_logScroll)); gtk_adjustment_set_value(adj, (gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj))); }
void send_scroll_event(int type, GtkAdjustment *adjust) { gdouble value = gtk_adjustment_get_value(adjust); gdouble min = gtk_adjustment_get_lower(adjust); gdouble max = gtk_adjustment_get_upper(adjust); gdouble page = gtk_adjustment_get_page_size(adjust); send_event (type, NULL, TYPE_FLOAT, value, TYPE_FLOAT, min, TYPE_FLOAT, max, TYPE_FLOAT, page, NULL); }
static gboolean eom_thumb_nav_scroll_event (GtkWidget *widget, GdkEventScroll *event, gpointer user_data) { EomThumbNav *nav = EOM_THUMB_NAV (user_data); gint inc = EOM_THUMB_NAV_SCROLL_INC * 3; if (nav->priv->mode != EOM_THUMB_NAV_MODE_ONE_ROW) return FALSE; switch (event->direction) { case GDK_SCROLL_UP: case GDK_SCROLL_LEFT: inc *= -1; break; case GDK_SCROLL_DOWN: case GDK_SCROLL_RIGHT: break; #if GTK_CHECK_VERSION (3, 3, 18) case GDK_SCROLL_SMOOTH: { /* Compatibility code to catch smooth events from mousewheels */ gdouble x_delta, y_delta; gboolean set = gdk_event_get_scroll_deltas ((GdkEvent*)event, &x_delta, &y_delta); /* Propagate horizontal smooth scroll events further, as well as non-mousewheel events. */ if (G_UNLIKELY (!set) || x_delta != 0.0 || fabs(y_delta) != 1.0) return FALSE; /* The y_delta is either +1.0 or -1.0 here */ inc *= (gint) y_delta; } break; #endif default: g_assert_not_reached (); return FALSE; } if (inc < 0) gtk_adjustment_set_value (nav->priv->adj, MAX (0, gtk_adjustment_get_value (nav->priv->adj) + inc)); else gtk_adjustment_set_value (nav->priv->adj, MIN (gtk_adjustment_get_upper (nav->priv->adj) - gtk_adjustment_get_page_size (nav->priv->adj), gtk_adjustment_get_value (nav->priv->adj) + inc)); return TRUE; }
/* * called from debugger module to show a message in debugger messages pane */ void on_debugger_message (const gchar* message, const gchar *color) { gchar *msg = g_strdup_printf("%s\n", message); GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(debugger_messages_textview)); GtkTextIter iter; gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, msg, -1, color, NULL); g_free(msg); gtk_adjustment_set_value(vadj, gtk_adjustment_get_upper(vadj)); }
static void scroll_new_row_tree (ScrollFixture *fixture, gconstpointer test_data) { GtkTreeModel *model; GtkAdjustment *vadjustment; int i; /* The goal of this test is to append new rows at the end of a tree * store and immediately scroll to them. If there is a parent * node with a couple of childs in the "area above" to explore, * this used to lead to unexpected results due to a bug. * * This issue has been reported by Miroslav Rajcic on * gtk-app-devel-list: * http://mail.gnome.org/archives/gtk-app-devel-list/2008-December/msg00068.html */ gtk_widget_show_all (fixture->window); gtk_tree_view_expand_all (GTK_TREE_VIEW (fixture->tree_view)); while (gtk_events_pending ()) gtk_main_iteration (); model = gtk_tree_view_get_model (GTK_TREE_VIEW (fixture->tree_view)); vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (fixture->tree_view)); for (i = 0; i < 5; i++) { GtkTreeIter scroll_iter; GtkTreePath *scroll_path; gtk_tree_store_append (GTK_TREE_STORE (model), &scroll_iter, NULL); gtk_tree_store_set (GTK_TREE_STORE (model), &scroll_iter, 0, "New node", -1); scroll_path = gtk_tree_model_get_path (model, &scroll_iter); gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (fixture->tree_view), scroll_path, NULL, FALSE, 0.0, 0.0); gtk_tree_path_free (scroll_path); while (gtk_events_pending ()) gtk_main_iteration (); /* Test position, the scroll bar must be at the end */ g_assert (gtk_adjustment_get_value (vadjustment) == gtk_adjustment_get_upper (vadjustment) - gtk_adjustment_get_page_size (vadjustment)); } }
static gboolean photos_utils_adjustment_can_scroll (GtkAdjustment *adjustment) { gdouble lower; gdouble page_size; gdouble upper; g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), FALSE); lower = gtk_adjustment_get_lower (adjustment); page_size = gtk_adjustment_get_page_size (adjustment); upper = gtk_adjustment_get_upper (adjustment); return upper - lower > page_size; }
static gboolean e_canvas_area_shown (GnomeCanvas *canvas, gdouble x1, gdouble y1, gdouble x2, gdouble y2) { GtkAdjustment *h, *v; gint dx = 0, dy = 0; gdouble page_size; gdouble lower; gdouble upper; gdouble value; g_return_val_if_fail (canvas != NULL, FALSE); g_return_val_if_fail (GNOME_IS_CANVAS (canvas), FALSE); h = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas)); page_size = gtk_adjustment_get_page_size (h); lower = gtk_adjustment_get_lower (h); upper = gtk_adjustment_get_upper (h); value = gtk_adjustment_get_value (h); dx = compute_offset (x1, x2, value, value + page_size); if (CLAMP (value + dx, lower, upper - page_size) - value != 0) return FALSE; v = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas)); page_size = gtk_adjustment_get_page_size (v); lower = gtk_adjustment_get_lower (v); upper = gtk_adjustment_get_upper (v); value = gtk_adjustment_get_value (v); dy = compute_offset (y1, y2, value, value + page_size); if (CLAMP (value + dy, lower, upper - page_size) - value != 0) return FALSE; return TRUE; }
void app_resizer_set_vadjustment_value (GtkWidget * widget, gdouble value) { GtkAdjustment *adjust; adjust = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget)); gdouble upper = gtk_adjustment_get_upper (adjust); gdouble page_size = gtk_adjustment_get_page_size (adjust); if (value > upper - page_size) { value = upper - page_size; } gtk_adjustment_set_value (adjust, value); }
static void vadjustment_changed_cb (GtkAdjustment *adjustment, gpointer user_data) { CbMediaImageWidget *self = user_data; double upper; double new_value; upper = gtk_adjustment_get_upper (adjustment); new_value = upper * self->initial_scroll_y - (gtk_adjustment_get_page_size (adjustment) / 2.0); gtk_adjustment_set_value (adjustment, new_value); g_signal_handler_disconnect (adjustment, self->vadj_changed_id); }
static void gimp_navigation_editor_scroll (GimpNavigationView *view, GdkScrollDirection direction, GimpNavigationEditor *editor) { if (editor->shell) { GtkAdjustment *adj = NULL; gdouble value; switch (direction) { case GDK_SCROLL_LEFT: case GDK_SCROLL_RIGHT: adj = editor->shell->hsbdata; break; case GDK_SCROLL_UP: case GDK_SCROLL_DOWN: adj = editor->shell->vsbdata; break; } g_assert (adj != NULL); value = gtk_adjustment_get_value (adj); switch (direction) { case GDK_SCROLL_LEFT: case GDK_SCROLL_UP: value -= gtk_adjustment_get_page_increment (adj) / 2; break; case GDK_SCROLL_RIGHT: case GDK_SCROLL_DOWN: value += gtk_adjustment_get_page_increment (adj) / 2; break; } value = CLAMP (value, gtk_adjustment_get_lower (adj), gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj)); gtk_adjustment_set_value (adj, value); } }
static gboolean gd_thumb_nav_scroll_event (GtkWidget *widget, GdkEventScroll *event, gpointer user_data) { GdThumbNav *nav = GD_THUMB_NAV (user_data); gint inc = GD_THUMB_NAV_SCROLL_INC * 3; gdouble upper, page_size, value; gdouble delta_x, delta_y; switch (event->direction) { case GDK_SCROLL_UP: case GDK_SCROLL_LEFT: inc *= -1; break; case GDK_SCROLL_DOWN: case GDK_SCROLL_RIGHT: break; case GDK_SCROLL_SMOOTH: gdk_event_get_scroll_deltas ((const GdkEvent *) event, &delta_x, &delta_y); if (delta_x == 0) { /* we only moved in the y direction, look at which direction */ if (delta_y < 0) inc *= -1; } else if (delta_x < 0) { /* if we moved in the x direction too, ignore the y */ inc *= -1; } break; default: g_assert_not_reached (); return FALSE; } value = gtk_adjustment_get_value (nav->priv->adj); upper = gtk_adjustment_get_upper (nav->priv->adj); page_size = gtk_adjustment_get_page_size (nav->priv->adj); if (inc < 0) gtk_adjustment_set_value (nav->priv->adj, MAX (0, value + inc)); else gtk_adjustment_set_value (nav->priv->adj, MIN (upper - page_size, value + inc)); return TRUE; }
static void eog_thumb_nav_adj_changed (GtkAdjustment *adj, gpointer user_data) { EogThumbNav *nav; EogThumbNavPrivate *priv; gboolean ltr; nav = EOG_THUMB_NAV (user_data); priv = EOG_THUMB_NAV_GET_PRIVATE (nav); ltr = gtk_widget_get_direction (priv->sw) == GTK_TEXT_DIR_LTR; gtk_widget_set_sensitive (ltr ? priv->button_right : priv->button_left, gtk_adjustment_get_value (adj) < gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj)); }
static void on_slider_changed(GtkRange *range, gpointer data) { struct gtk_common_data *mdata = data; GtkAdjustment *adj = gtk_range_get_adjustment(GTK_RANGE(mdata->widget)); struct sol_irange val; val.val = gtk_range_get_value(GTK_RANGE(mdata->widget)); val.min = (int)gtk_adjustment_get_lower(adj); val.max = (int)gtk_adjustment_get_upper(adj); val.step = (int)gtk_adjustment_get_step_increment(adj); sol_flow_send_irange_packet(mdata->node, SOL_FLOW_NODE_TYPE_GTK_SLIDER__OUT__OUT, &val); }
void zathura_adjustment_set_value_from_ratio(GtkAdjustment* adjustment, gdouble ratio) { if (ratio == 0.0) { return; } gdouble lower = gtk_adjustment_get_lower(adjustment); gdouble upper = gtk_adjustment_get_upper(adjustment); gdouble page_size = gtk_adjustment_get_page_size(adjustment); gdouble value = (upper - lower) * ratio + lower - page_size / 2.0; zathura_adjustment_set_value(adjustment, value); }
static void gtk_scale_button_accessible_get_maximum_value (AtkValue *obj, GValue *value) { GtkWidget *widget; GtkAdjustment *adjustment; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget)); if (adjustment == NULL) return; memset (value, 0, sizeof (GValue)); g_value_init (value, G_TYPE_DOUBLE); g_value_set_double (value, gtk_adjustment_get_upper (adjustment)); }
void page_viewport (void) { gdouble value, upper; GtkAdjustment *adj = GTK_ADJUSTMENT (Denemo.hadjustment); //g_debug("%d %d\n", Denemo.project->movement->leftmeasurenum, Denemo.project->movement->rightmeasurenum); gint amount = (Denemo.project->movement->rightmeasurenum - Denemo.project->movement->leftmeasurenum + 1); value = gtk_adjustment_get_value (adj); upper = gtk_adjustment_get_upper (adj); if (value + amount < upper) { gtk_adjustment_set_value (adj, value + amount); } else gtk_adjustment_set_value (adj, upper - 1); }
/* Auxiliary methods */ static gboolean update_grid_scroll_position (GcalWeekView *self) { g_autoptr(GDateTime) week_start = NULL; g_autoptr(GDateTime) week_end = NULL; g_autoptr(GDateTime) now = NULL; GtkAdjustment *vadjustment; gdouble minutes, real_value; gdouble max, page, page_increment, value; /* While the scrolled window is not mapped, we keep waiting */ if (!gtk_widget_get_realized (self->scrolled_window) || !gtk_widget_get_mapped (self->scrolled_window)) { GCAL_RETURN (G_SOURCE_CONTINUE); } now = g_date_time_new_now_local (); week_start = get_start_of_week (self->date); week_end = get_end_of_week (self->date); /* Don't animate when not today */ if (datetime_compare_date (now, week_start) < 0 || datetime_compare_date (now, week_end) >= 0) GCAL_GOTO (out); vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (self->scrolled_window)); minutes = g_date_time_get_hour (now) * 60 + g_date_time_get_minute (now); page = gtk_adjustment_get_page_size (vadjustment); max = gtk_adjustment_get_upper (vadjustment); real_value = max / MINUTES_PER_DAY * minutes - (page / 2.0); page_increment = gtk_adjustment_get_page_increment (vadjustment); value = gtk_adjustment_get_value (vadjustment); gtk_adjustment_set_page_increment (vadjustment, real_value - value); g_signal_emit_by_name (self->scrolled_window, "scroll-child", GTK_SCROLL_PAGE_FORWARD, FALSE); gtk_adjustment_set_page_increment (vadjustment, page_increment); out: self->scroll_grid_timeout_id = 0; GCAL_RETURN (G_SOURCE_REMOVE); }
static void onkeyrelease(GtkEntry *entry, GdkEventKey *event, gpointer user_data) { if(event->keyval == GDK_Return) { gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_APPLY); } else if(event->keyval == GDK_Down || event->keyval == GDK_Up || event->keyval == GDK_Left || event->keyval == GDK_Right) { //Ignore keypresses that don't modify the text. } else { row_pos = 0; gtk_tree_store_clear(list); list_files(base_directory, gtk_entry_get_text(entry)); gtk_adjustment_set_value(adjustment, gtk_adjustment_get_upper(adjustment)); gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree), first, NULL, FALSE); } }
void my_timeline_model_add_at_current_pos (MyTimelineModel * self) { guint i; MyTimelineModelPrivate *priv = my_timeline_model_get_instance_private (self); for (i = TIMELINE_MODEL_CURRENT_INDEX + 1; i < TIMELINE_MODEL_CURRENT_INDEX + 3; i++) { g_ptr_array_insert_empty_array_at_pos (priv->tl_systems_data, i); g_ptr_array_insert_empty_array_at_pos (priv->tl_arrows, i); g_signal_emit (G_OBJECT (self), signals[SIG_TIME_POS_ADDED], 0, i); } i = gtk_adjustment_get_upper (priv->adjust); gtk_adjustment_set_upper (priv->adjust, i + 2); }
/** * gtk_test_slider_set_perc: * @widget: valid widget pointer. * @percentage: value between 0 and 100. * * This function will adjust the slider position of all GtkRange * based widgets, such as scrollbars or scales, it'll also adjust * spin buttons. The adjustment value of these widgets is set to * a value between the lower and upper limits, according to the * @percentage argument. * * Since: 2.14 **/ void gtk_test_slider_set_perc (GtkWidget *widget, double percentage) { GtkAdjustment *adjustment = NULL; if (GTK_IS_RANGE (widget)) adjustment = gtk_range_get_adjustment (GTK_RANGE (widget)); else if (GTK_IS_SPIN_BUTTON (widget)) adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); if (adjustment) gtk_adjustment_set_value (adjustment, gtk_adjustment_get_lower (adjustment) + (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment) - gtk_adjustment_get_page_size (adjustment)) * percentage * 0.01); }