Exemple #1
0
static void volume_control_button_update_value(GtkWidget *widget) {
    LinphoneCall *call = (LinphoneCall *)g_object_get_data(G_OBJECT(widget), "call");
    VolumeControlType type = (VolumeControlType)g_object_get_data(G_OBJECT(widget), "type");

    if(type == VOLUME_CTRL_PLAYBACK) {
        gtk_scale_button_set_value(GTK_SCALE_BUTTON(widget), linphone_call_get_speaker_volume_gain(call));
    } else if(type == VOLUME_CTRL_RECORD) {
        gtk_scale_button_set_value(GTK_SCALE_BUTTON(widget), linphone_call_get_microphone_volume_gain(call));
    }
}
static void
toggle_orientation (GtkWidget *button,
                    GtkWidget *scalebutton)
{
  if (gtk_scale_button_get_orientation (GTK_SCALE_BUTTON (scalebutton)) ==
      GTK_ORIENTATION_HORIZONTAL)
    {
      gtk_scale_button_set_orientation (GTK_SCALE_BUTTON (scalebutton),
                                        GTK_ORIENTATION_VERTICAL);
    }
  else
    {
      gtk_scale_button_set_orientation (GTK_SCALE_BUTTON (scalebutton),
                                        GTK_ORIENTATION_HORIZONTAL);
    }
}
static gboolean
gtk_scale_button_scroll (GtkWidget      *widget,
			 GdkEventScroll *event)
{
  GtkScaleButton *button;
  GtkScaleButtonPrivate *priv;
  GtkAdjustment *adj;
  gdouble d;

  button = GTK_SCALE_BUTTON (widget);
  priv = button->priv;
  adj = priv->adjustment;

  if (event->type != GDK_SCROLL)
    return FALSE;

  d = gtk_scale_button_get_value (button);
  if (event->direction == GDK_SCROLL_UP)
    {
      d += adj->step_increment;
      if (d > adj->upper)
	d = adj->upper;
    }
  else
    {
      d -= adj->step_increment;
      if (d < adj->lower)
	d = adj->lower;
    }
  gtk_scale_button_set_value (button, d);

  return TRUE;
}
Exemple #4
0
static void
gtk_volume_button_set_property (GObject       *object,
                                guint          prop_id,
                                const GValue  *value,
                                GParamSpec    *pspec)
{
    GtkScaleButton *button = GTK_SCALE_BUTTON (object);

    switch (prop_id)
    {
    case PROP_SYMBOLIC:
        if (get_symbolic (button) != g_value_get_boolean (value))
        {
            if (g_value_get_boolean (value))
                gtk_scale_button_set_icons (button, (const char **) icons_symbolic);
            else
                gtk_scale_button_set_icons (button, (const char **) icons);
            g_object_notify_by_pspec (object, pspec);
        }
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        break;
    }
}
void FullscreenVideoControllerGtk::hideHud()
{
    if (m_hudTimeoutId) {
        g_source_remove(m_hudTimeoutId);
        m_hudTimeoutId = 0;
    }

    if (!m_hudWindow)
        return;

    // Keep the hud visible if a seek is in progress or if the volume
    // popup is visible.
    GtkWidget* volumePopup = gtk_scale_button_get_popup(GTK_SCALE_BUTTON(m_volumeButton));
    if (m_seekLock || gtk_widget_get_visible(volumePopup)) {
        showHud(true);
        return;
    }

    GdkWindow* window = gtk_widget_get_window(m_window);
    GRefPtr<GdkCursor> cursor = adoptGRef(gdk_cursor_new(GDK_BLANK_CURSOR));
    gdk_window_set_cursor(window, cursor.get());

    gtk_widget_hide(m_hudWindow);

    if (m_progressBarUpdateId) {
        g_source_remove(m_progressBarUpdateId);
        m_progressBarUpdateId = 0;
    }
}
Exemple #6
0
static void bar_pane_gps_view_state_changed_cb(ChamplainView *view,
           				       GParamSpec *gobject,
           				       gpointer data)
{
	PaneGPSData *pgd = data;
 	ChamplainState status;
 	gint zoom;
	GString *message;

	g_object_get(G_OBJECT(view), "zoom-level", &zoom, NULL);
	message = g_string_new("");
	g_string_printf(message, _("Zoom level %i"), zoom);

	g_object_get(G_OBJECT(view), "state", &status, NULL);
	if (status == CHAMPLAIN_STATE_LOADING)
		{
		gtk_label_set_text(GTK_LABEL(pgd->state), _("Loading map"));
		}
	else
		{
		gtk_label_set_text(GTK_LABEL(pgd->state), message->str);
		}
		
	gtk_widget_set_tooltip_text(GTK_WIDGET(pgd->slider), message->str);
	gtk_scale_button_set_value(GTK_SCALE_BUTTON(pgd->slider), (gdouble)zoom);

	g_string_free(message, TRUE);
}
static void
gtk_scale_button_accessible_notify_gtk (GObject    *obj,
                                        GParamSpec *pspec)
{
  GtkScaleButton *scale_button;
  GtkScaleButtonAccessible *accessible;

  scale_button = GTK_SCALE_BUTTON (obj);
  accessible = GTK_SCALE_BUTTON_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (scale_button)));

  if (strcmp (pspec->name, "adjustment") == 0)
    {
      GtkAdjustment* adjustment;

      adjustment = gtk_scale_button_get_adjustment (scale_button);
      g_signal_connect (adjustment,
                        "value-changed",
                        G_CALLBACK (gtk_scale_button_accessible_value_changed),
                        accessible);
    }
  else
    {
      GTK_WIDGET_ACCESSIBLE_CLASS (gtk_scale_button_accessible_parent_class)->notify_gtk (obj, pspec);
    }
}
static gboolean
cb_button_press (GtkWidget      *widget,
		 GdkEventButton *event,
		 gpointer        user_data)
{
  GtkScaleButton *button;
  GtkScaleButtonPrivate *priv;
  GtkAdjustment *adj;

  button = GTK_SCALE_BUTTON (user_data);
  priv = button->priv;
  adj = priv->adjustment;

  if (priv->click_id != 0)
    g_source_remove (priv->click_id);

  if (widget == button->plus_button)
    priv->direction = fabs (adj->page_increment);
  else
    priv->direction = - fabs (adj->page_increment);

  priv->click_id = gdk_threads_add_timeout (priv->click_timeout,
                                            cb_button_timeout,
                                            button);
  cb_button_timeout (button);

  return TRUE;
}
static GObject *
gtk_scale_button_constructor (GType                  type,
                              guint                  n_construct_properties,
                              GObjectConstructParam *construct_params)
{
  GObject *object;
  GtkScaleButton *button;
  GtkWidget *frame, *box;
  GtkScaleButtonPrivate *priv;

  object = G_OBJECT_CLASS (gtk_scale_button_parent_class)->constructor (type, n_construct_properties, construct_params);

  button = GTK_SCALE_BUTTON (object);

  priv = button->priv;

  /* frame */
  frame = gtk_frame_new (NULL);
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
  gtk_container_add (GTK_CONTAINER (priv->dock), frame);

  /* box with scale and +/- buttons */
  box = gtk_scale_button_scale_box_new (button);
  gtk_container_add (GTK_CONTAINER (frame), box);

  /* set button text and size */
  priv->size = GTK_ICON_SIZE_SMALL_TOOLBAR;
  gtk_scale_button_update_icon (button);

  return object;
}
static void
gtk_scale_button_get_property (GObject     *object,
			       guint        prop_id,
			       GValue      *value,
			       GParamSpec  *pspec)
{
  GtkScaleButton *button = GTK_SCALE_BUTTON (object);
  GtkScaleButtonPrivate *priv = button->priv;

  switch (prop_id)
    {
    case PROP_ORIENTATION:
      g_value_set_enum (value, priv->orientation);
      break;
    case PROP_VALUE:
      g_value_set_double (value, gtk_scale_button_get_value (button));
      break;
    case PROP_SIZE:
      g_value_set_enum (value, priv->size);
      break;
    case PROP_ADJUSTMENT:
      g_value_set_object (value, gtk_scale_button_get_adjustment (button));
      break;
    case PROP_ICONS:
      g_value_set_boxed (value, priv->icon_list);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
static void
garu_headerbar_init_playback_buttons (GaruHeaderbar *self)
{
  GSettings       *settings;
  GaruApplication *app;
  GtkWidget       *box, *button, *image;

  app = GARU_APPLICATION (g_application_get_default ());
  settings = garu_application_get_settings (app);

  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);

  /* shuffle */
  button = garu_utils_new_icon_button ("media-playlist-shuffle-symbolic",
				       TRUE, FALSE);
  gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
  gtk_widget_show (button);
  /* repeat */
  button = garu_utils_new_icon_button ("media-playlist-repeat-symbolic",
				       TRUE, FALSE);
  
  gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
  gtk_widget_show (button);
  /* volume */
  button = gtk_volume_button_new ();
  gtk_scale_button_set_value (GTK_SCALE_BUTTON (button), 1);
  g_settings_bind (settings, "volume", button, "value",
                   G_SETTINGS_BIND_DEFAULT);
  gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
  gtk_widget_show (button);

  gtk_header_bar_pack_end (GTK_HEADER_BAR (self), box);
  gtk_widget_show (box);
}
Exemple #12
0
void
tuner_set_squelch()
{
    gchar buffer[5];
    g_snprintf(buffer, sizeof(buffer), "Q%ld", lround(gtk_scale_button_get_value(GTK_SCALE_BUTTON(ui.squelch))));
    tuner_write(tuner.thread, buffer);
    tuner.last_set_squelch = g_get_real_time() / 1000;
}
Exemple #13
0
static void
update_mastervol(void *opaque, float value)
{
  playdeck_t *pd = opaque;

  value = (value / 75.0) + 1;
  gtk_scale_button_set_value(GTK_SCALE_BUTTON(pd->volume), value);
}
gboolean
headerbarui_volume_changed(gpointer user_data)
{
    float volume = deadbeef->volume_get_min_db()-deadbeef->volume_get_db();
    g_assert_false((volume>0));
    gtk_scale_button_set_value( GTK_SCALE_BUTTON (volbutton), (int)-volume );
    return FALSE;
}
void FullscreenVideoControllerGtk::muteChanged()
{
    if (!m_volumeButton)
        return;

    g_signal_handler_block(m_volumeButton, m_volumeUpdateId);
    gtk_scale_button_set_value(GTK_SCALE_BUTTON(m_volumeButton), m_player->muted() ? 0 : m_player->volume());
    g_signal_handler_unblock(m_volumeButton, m_volumeUpdateId);
}
Exemple #16
0
static gboolean ui_volume_slider_update(gpointer data)
{
    gint volume;

    if (volume_slider_is_moving || data == NULL)
        return TRUE;

    aud_drct_get_volume_main(&volume);

    if (volume == (gint) gtk_scale_button_get_value(GTK_SCALE_BUTTON(data)))
        return TRUE;

    g_signal_handler_block(data, volume_change_handler_id);
    gtk_scale_button_set_value(GTK_SCALE_BUTTON(data), volume);
    g_signal_handler_unblock(data, volume_change_handler_id);

    return TRUE;
}
void FullscreenVideoControllerGtk::createHud()
{
    m_hudWindow = gtk_window_new(GTK_WINDOW_POPUP);
    gtk_window_set_gravity(GTK_WINDOW(m_hudWindow), GDK_GRAVITY_SOUTH_WEST);
    gtk_window_set_type_hint(GTK_WINDOW(m_hudWindow), GDK_WINDOW_TYPE_HINT_NORMAL);

    m_hudMotionNotifySignalId = g_signal_connect(m_hudWindow, "motion-notify-event", G_CALLBACK(onFullscreenGtkMotionNotifyEvent), this);

#ifdef GTK_API_VERSION_2
    GtkWidget* hbox = gtk_hbox_new(FALSE, 4);
#else
    GtkWidget* hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
#endif
    gtk_container_add(GTK_CONTAINER(m_hudWindow), hbox);

    m_playPauseAction = gtk_action_new("play", _("Play / Pause"), _("Play or pause the media"), PAUSE_ICON_NAME);
    m_playActionActivateSignalId = g_signal_connect(m_playPauseAction, "activate", G_CALLBACK(togglePlayPauseActivated), this);

    GtkWidget* item = gtk_action_create_tool_item(m_playPauseAction);
    gtk_box_pack_start(GTK_BOX(hbox), item, FALSE, TRUE, 0);

    GtkWidget* label = gtk_label_new(_("Time:"));
    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0);

    GtkAdjustment* adjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 100.0, 0.1, 1.0, 1.0));
#ifdef GTK_API_VERSION_2
    m_timeHScale = gtk_hscale_new(adjustment);
#else
    m_timeHScale = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, adjustment);
#endif
    gtk_scale_set_draw_value(GTK_SCALE(m_timeHScale), FALSE);
    gtk_range_set_show_fill_level(GTK_RANGE(m_timeHScale), TRUE);
    m_timeScaleButtonPressedSignalId = g_signal_connect(m_timeHScale, "button-press-event", G_CALLBACK(timeScaleButtonPressed), this);
    m_timeScaleButtonReleasedSignalId = g_signal_connect(m_timeHScale, "button-release-event", G_CALLBACK(timeScaleButtonReleased), this);
    m_hscaleUpdateId = g_signal_connect(m_timeHScale, "value-changed", G_CALLBACK(timeScaleValueChanged), this);

    gtk_box_pack_start(GTK_BOX(hbox), m_timeHScale, TRUE, TRUE, 0);

    m_timeLabel = gtk_label_new("");
    gtk_box_pack_start(GTK_BOX(hbox), m_timeLabel, FALSE, TRUE, 0);

    // Volume button.
    m_volumeButton = gtk_volume_button_new();
    gtk_box_pack_start(GTK_BOX(hbox), m_volumeButton, FALSE, TRUE, 0);
    gtk_scale_button_set_value(GTK_SCALE_BUTTON(m_volumeButton), m_player->volume());
    m_volumeUpdateId = g_signal_connect(m_volumeButton, "value-changed", G_CALLBACK(volumeValueChanged), this);

    m_exitFullscreenAction = gtk_action_new("exit", _("Exit Fullscreen"), _("Exit from fullscreen mode"), EXIT_FULLSCREEN_ICON_NAME);
    m_exitFullcreenActionActivateSignalId = g_signal_connect(m_exitFullscreenAction, "activate", G_CALLBACK(exitFullscreenActivated), this);
    g_object_set(m_exitFullscreenAction, "icon-name", EXIT_FULLSCREEN_ICON_NAME, NULL);
    item = gtk_action_create_tool_item(m_exitFullscreenAction);
    gtk_box_pack_start(GTK_BOX(hbox), item, FALSE, TRUE, 0);

    m_progressBarUpdateId = g_timeout_add(PROGRESS_BAR_UPDATE_INTERVAL, reinterpret_cast<GSourceFunc>(progressBarUpdateCallback), this);

    playStateChanged();
}
Exemple #18
0
void
tuner_set_volume()
{
    gchar buffer[5];
    conf.volume = lround(gtk_scale_button_get_value(GTK_SCALE_BUTTON(ui.volume)));
    g_snprintf(buffer, sizeof(buffer), "Y%d", conf.volume);
    tuner_write(tuner.thread, buffer);
    tuner.last_set_volume = g_get_real_time() / 1000;
}
static void
autoquality_toggled(GtkToggleButton *button, CurrentCallView *self)
{
    g_return_if_fail(IS_CURRENT_CALL_VIEW(self));
    CurrentCallViewPrivate *priv = CURRENT_CALL_VIEW_GET_PRIVATE(self);

    gboolean auto_quality_on = gtk_toggle_button_get_active(button);

    auto scale = gtk_scale_button_get_scale(GTK_SCALE_BUTTON(priv->scalebutton_quality));
    auto plus_button = gtk_scale_button_get_plus_button(GTK_SCALE_BUTTON(priv->scalebutton_quality));
    auto minus_button = gtk_scale_button_get_minus_button(GTK_SCALE_BUTTON(priv->scalebutton_quality));

    gtk_widget_set_sensitive(GTK_WIDGET(scale), !auto_quality_on);
    gtk_widget_set_sensitive(plus_button, !auto_quality_on);
    gtk_widget_set_sensitive(minus_button, !auto_quality_on);

    double desired_quality = gtk_scale_button_get_value(GTK_SCALE_BUTTON(priv->scalebutton_quality));

    if (priv->call)
        set_quality(priv->call, auto_quality_on, desired_quality);
}
Exemple #20
0
static void
gail_scale_button_get_current_value (AtkValue *obj,
                                     GValue   *value)
{
  GtkScaleButton *gtk_scale_button;

  g_return_if_fail (GAIL_IS_SCALE_BUTTON (obj));

  gtk_scale_button = GTK_SCALE_BUTTON (GTK_ACCESSIBLE (obj)->widget);

  g_value_set_double (g_value_init (value, G_TYPE_DOUBLE),
                      gtk_scale_button_get_value (gtk_scale_button));
}
static gboolean
quality_button_released(G_GNUC_UNUSED GtkWidget *widget, G_GNUC_UNUSED GdkEvent *event, CurrentCallView *self)
{
    g_return_val_if_fail(IS_CURRENT_CALL_VIEW(self), FALSE);
    CurrentCallViewPrivate *priv = CURRENT_CALL_VIEW_GET_PRIVATE(self);

    priv->quality_scale_pressed = FALSE;

    /* now make sure the quality gets updated */
    quality_changed(GTK_SCALE_BUTTON(priv->scalebutton_quality), 0, self);

    return GDK_EVENT_PROPAGATE;
}
static gboolean
cb_dock_button_press (GtkWidget      *widget,
		      GdkEventButton *event,
		      gpointer        user_data)
{
  GtkScaleButton *button = GTK_SCALE_BUTTON (user_data);

  if (event->type == GDK_BUTTON_PRESS)
    {
      gtk_scale_button_release_grab (button, event);
      return TRUE;
    }

  return FALSE;
}
static gboolean
gtk_scale_button_accessible_set_current_value (AtkValue     *obj,
                                               const 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 FALSE;

  gtk_adjustment_set_value (adjustment, g_value_get_double (value));

  return TRUE;
}
static void
gtk_scale_button_accessible_get_minimum_increment (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_minimum_increment (adjustment));
}
Exemple #25
0
static void
gtk_volume_button_get_property (GObject     *object,
                                guint        prop_id,
                                GValue      *value,
                                GParamSpec  *pspec)
{
    switch (prop_id)
    {
    case PROP_SYMBOLIC:
        g_value_set_boolean (value, get_symbolic (GTK_SCALE_BUTTON (object)));
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        break;
    }
}
Exemple #26
0
static gboolean
cb_query_tooltip (GtkWidget  *button,
                  gint        x,
                  gint        y,
                  gboolean    keyboard_mode,
                  GtkTooltip *tooltip,
                  gpointer    user_data)
{
    GtkScaleButton *scale_button = GTK_SCALE_BUTTON (button);
    GtkAdjustment *adjustment;
    gdouble val;
    char *str;
    AtkImage *image;

    image = ATK_IMAGE (gtk_widget_get_accessible (button));

    adjustment = gtk_scale_button_get_adjustment (scale_button);
    val = gtk_scale_button_get_value (scale_button);

    if (val < (gtk_adjustment_get_lower (adjustment) + EPSILON))
    {
        str = g_strdup (_("Muted"));
    }
    else if (val >= (gtk_adjustment_get_upper (adjustment) - EPSILON))
    {
        str = g_strdup (_("Full Volume"));
    }
    else
    {
        int percent;

        percent = (int) (100. * val / (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment)) + .5);

        /* Translators: this is the percentage of the current volume,
         * as used in the tooltip, eg. "49 %".
         * Translate the "%d" to "%Id" if you want to use localised digits,
         * or otherwise translate the "%d" to "%d".
         */
        str = g_strdup_printf (C_("volume percentage", "%d %%"), percent);
    }

    gtk_tooltip_set_text (tooltip, str);
    atk_image_set_image_description (image, str);
    g_free (str);

    return TRUE;
}
Exemple #27
0
static void
player_av_set_volume (Player *self, gdouble vol)
{
    PlayerAVPrivate *priv = PLAYER_AV (self)->priv;

    if (priv->volume != vol) {
        if (vol > 1.0) vol = 1.0;
        if (vol < 0.0) vol = 0.0;

        priv->volume = vol;

        gtk_scale_button_set_value (GTK_SCALE_BUTTON (priv->fs_vol), priv->volume);

//        g_signal_emit (self, signal_volume, 0, vol);
        _player_emit_volume_changed (PLAYER (self), priv->volume);
    }
}
static void
gtk_scale_button_accessible_initialize (AtkObject *obj,
                                        gpointer   data)
{
  GtkAdjustment *adjustment;

  ATK_OBJECT_CLASS (gtk_scale_button_accessible_parent_class)->initialize (obj, data);

  adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (data));
  if (adjustment)
    g_signal_connect (adjustment,
                      "value-changed",
                      G_CALLBACK (gtk_scale_button_accessible_value_changed),
                      obj);

  obj->role = ATK_ROLE_SLIDER;
}
Exemple #29
0
static void
gail_scale_button_get_minimum_increment (AtkValue *obj,
                                         GValue   *value)
{
  GtkWidget *gtk_widget;
  GtkAdjustment *adj;

  g_return_if_fail (GAIL_IS_SCALE_BUTTON (obj));

  gtk_widget = GTK_ACCESSIBLE (obj)->widget;
  if (gtk_widget == NULL)
    return;

  adj = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (gtk_widget));
  if (adj != NULL)
    g_value_set_double (g_value_init (value, G_TYPE_DOUBLE),
                        adj->step_increment);
}
static gboolean
cb_button_release (GtkWidget      *widget,
		   GdkEventButton *event,
		   gpointer        user_data)
{
  GtkScaleButton *button;
  GtkScaleButtonPrivate *priv;

  button = GTK_SCALE_BUTTON (user_data);
  priv = button->priv;

  if (priv->click_id != 0)
    {
      g_source_remove (priv->click_id);
      priv->click_id = 0;
    }

  return TRUE;
}