Ejemplo n.º 1
0
static void
ephy_title_box_add_address_bar (EphyTitleBox *title_box)
{
  title_box->entry = ephy_location_entry_new ();
  gtk_widget_show (title_box->entry);
  gtk_stack_add_named (GTK_STACK (title_box), title_box->entry, "address-bar");
}
Ejemplo n.º 2
0
static void
ekiga_window_init_dialpad (EkigaWindow *mw)
{
  GtkWidget *dialpad = NULL;
  GtkWidget *grid = NULL;

  grid = gtk_grid_new ();
  gtk_grid_set_row_spacing (GTK_GRID (grid), 18);
  gtk_container_set_border_width (GTK_CONTAINER (grid), 18);

  dialpad = ekiga_dialpad_new (mw->priv->accel);
  gtk_widget_set_hexpand (dialpad, FALSE);
  gtk_widget_set_vexpand (dialpad, FALSE);
  gtk_widget_set_halign (dialpad, GTK_ALIGN_CENTER);
  gtk_widget_set_valign (dialpad, GTK_ALIGN_CENTER);
  gtk_grid_attach (GTK_GRID (grid), dialpad, 0, 0, 1, 1);
  g_signal_connect (dialpad, "button-clicked",
                    G_CALLBACK (dialpad_button_clicked_cb), mw);

  mw->priv->entry = ekiga_window_uri_entry_new (mw);
  gtk_widget_set_hexpand (dialpad, TRUE);
  gtk_widget_set_vexpand (dialpad, TRUE);
  gtk_widget_set_halign (mw->priv->entry, GTK_ALIGN_FILL);
  gtk_widget_set_valign (mw->priv->entry, GTK_ALIGN_END);
  gtk_grid_attach_next_to (GTK_GRID (grid), mw->priv->entry, dialpad,
                           GTK_POS_BOTTOM, 1, 1);

  gtk_stack_add_named (GTK_STACK (mw->priv->main_stack), grid, "dialpad");
  gtk_container_child_set (GTK_CONTAINER (mw->priv->main_stack),
                           grid,
                           "icon-name", "input-dialpad-symbolic", NULL);

  g_signal_connect (mw, "key-press-event",
                    G_CALLBACK (key_press_event_cb), mw);
}
Ejemplo n.º 3
0
void
bjb_window_base_switch_to_item (BjbWindowBase *bwb, BijiItem *item)
{
  BjbWindowBasePriv *priv = bwb->priv;
  GtkWidget *w = GTK_WIDGET (bwb);

  bjb_search_toolbar_disconnect (priv->search_bar);
  bjb_search_toolbar_fade_out (priv->search_bar);
  destroy_note_if_needed (bwb);

  if (BIJI_IS_NOTE_OBJ (item))
  {

    BijiNoteObj *note = BIJI_NOTE_OBJ (item);

    priv->note = note;

    priv->note_view = bjb_note_view_new (w, note);
    gtk_stack_add_named (priv->stack, GTK_WIDGET (priv->note_view), "note-view");

    g_object_add_weak_pointer (G_OBJECT (priv->note_view),
                               (gpointer *) &priv->note_view);

    bjb_window_base_switch_to (bwb, BJB_WINDOW_BASE_NOTE_VIEW);
    gtk_widget_show (w);
    bjb_note_view_grab_focus (priv->note_view);
  }
}
Ejemplo n.º 4
0
void
ev_sidebar_add_page (EvSidebar   *ev_sidebar,
                     GtkWidget   *widget,
                     const gchar *name,
		     const gchar *title,
		     const gchar *icon_name)
{
	EvSidebarPrivate *priv;
	GtkTreeIter iter;

	g_return_if_fail (EV_IS_SIDEBAR (ev_sidebar));
	g_return_if_fail (GTK_IS_WIDGET (widget));

	priv = GET_PRIVATE (ev_sidebar);

	ev_sidebar_page_set_model (EV_SIDEBAR_PAGE (widget), priv->model);

	gtk_stack_add_named (GTK_STACK (priv->stack), widget, name);
	gtk_container_child_set (GTK_CONTAINER (priv->stack), widget,
				 "icon-name", icon_name,
				 "title", title,
				 NULL);

	/* Insert and move to end */
	gtk_list_store_insert_with_values (GTK_LIST_STORE (priv->page_model),
					   &iter, 0,
					   PAGE_COLUMN_NAME, name,
					   PAGE_COLUMN_MAIN_WIDGET, widget,
					   PAGE_COLUMN_TITLE, title,
					   PAGE_COLUMN_ICON_NAME, icon_name,
					   -1);
	gtk_list_store_move_before (GTK_LIST_STORE (priv->page_model),
				    &iter, NULL);
}
Ejemplo n.º 5
0
static void
gtk_inspector_window_init (GtkInspectorWindow *iw)
{
  GIOExtensionPoint *extension_point;
  GList *l, *extensions;

  gtk_widget_init_template (GTK_WIDGET (iw));

  gtk_window_group_add_window (gtk_window_group_new (), GTK_WINDOW (iw));

  extension_point = g_io_extension_point_lookup ("gtk-inspector-page");
  extensions = g_io_extension_point_get_extensions (extension_point);

  for (l = extensions; l != NULL; l = l->next)
    {
      GIOExtension *extension = l->data;
      GType type;
      GtkWidget *widget;
      const char *name;
      char *title;
      GtkWidget *button;
      gboolean use_picker;

      type = g_io_extension_get_type (extension);

      widget = g_object_new (type, NULL);

      iw->extra_pages = g_list_prepend (iw->extra_pages, widget);

      name = g_io_extension_get_name (extension);
      g_object_get (widget, "title", &title, NULL);

      if (g_object_class_find_property (G_OBJECT_GET_CLASS (widget), "use-picker"))
        g_object_get (widget, "use-picker", &use_picker, NULL);
      else
        use_picker = FALSE;

      if (use_picker)
        {
          button = gtk_button_new_from_icon_name ("find-location-symbolic",
                                                  GTK_ICON_SIZE_MENU);
          gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
          gtk_widget_set_halign (button, GTK_ALIGN_START);
          gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
          g_signal_connect (button, "clicked",
                            G_CALLBACK (gtk_inspector_on_inspect), iw);
        }
      else
        button = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

      gtk_stack_add_titled (GTK_STACK (iw->top_stack), widget, name, title);
      gtk_stack_add_named (GTK_STACK (iw->button_stack), button, name);
      gtk_widget_show (widget);
      gtk_widget_show (button);

      g_free (title);
    }

}
Ejemplo n.º 6
0
static void
show_account_creation(RingMainWindow *win)
{
    RingMainWindowPrivate *priv = RING_MAIN_WINDOW_GET_PRIVATE(win);

    gtk_stack_add_named(GTK_STACK(priv->stack_main_view),
                        priv->account_creation_1,
                        CREATE_ACCOUNT_1_VIEW_NAME);

    gtk_stack_add_named(GTK_STACK(priv->stack_main_view),
                        priv->account_creation_2,
                        CREATE_ACCOUNT_2_VIEW_NAME);

    /* hide settings button until account creation is complete */
    gtk_widget_hide(priv->ring_settings);

    /* set ring logo */
    GError *error = NULL;
    GdkPixbuf* logo_ring = gdk_pixbuf_new_from_resource_at_scale("/cx/ring/RingGnome/ring-logo-blue",
                                                                  -1, 75, TRUE, &error);
    if (logo_ring == NULL) {
        g_debug("Could not load logo: %s", error->message);
        g_clear_error(&error);
    } else
        gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image_ring_logo), logo_ring);

    /* style of alias and hash entry; give them a larger font */
    gtk_widget_override_font(priv->entry_alias, pango_font_description_from_string("15"));
    gtk_widget_override_font(priv->entry_hash, pango_font_description_from_string("monospace 15"));
    gtk_entry_set_text(GTK_ENTRY(priv->entry_alias), g_get_real_name());

    /* connect signals */
    g_signal_connect(priv->entry_alias, "changed", G_CALLBACK(alias_entry_changed), win);
    g_signal_connect(priv->button_account_creation_next, "clicked", G_CALLBACK(account_creation_next_clicked), win);
    g_signal_connect(priv->button_account_creation_done, "clicked", G_CALLBACK(account_creation_done_clicked), win);
    g_signal_connect(priv->entry_alias, "activate", G_CALLBACK(entry_alias_activated), win);
    g_signal_connect_swapped(priv->entry_hash, "activate", G_CALLBACK(gtk_button_clicked), priv->button_account_creation_done);

    gtk_stack_set_visible_child_name(GTK_STACK(priv->stack_main_view), CREATE_ACCOUNT_1_VIEW_NAME);
}
static void 
nemo_context_menu_menu_item_init (NemoContextMenuMenuItem *item)
{
    item->on_toggle = FALSE;
    GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

    GtkWidget *stack = gtk_stack_new ();

    item->stack = stack;

    GtkWidget *label = gtk_label_new (NULL);
    gtk_misc_set_alignment (GTK_MISC (label), 0.98, 0.5);
    gtk_stack_add_named (GTK_STACK (stack), label, "toggle");
    item->toggle_label_widget = label;

    label = gtk_label_new (NULL);
    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
    gtk_stack_add_named (GTK_STACK (stack), label, "action");
    item->label_widget = label;

    gtk_box_pack_start (GTK_BOX (box), stack, TRUE, TRUE, 0);

    GtkWidget *toggle = gtk_image_new ();
    gtk_box_pack_end (GTK_BOX (box), toggle, FALSE, FALSE, 0);
    item->toggle_widget = toggle;

    gtk_widget_show_all (box);

    gtk_container_add (GTK_CONTAINER (item), box);

    update_toggle_state (item, FALSE, FALSE);

    item->settings_monitor_id = g_signal_connect_swapped (nemo_preferences, 
                                                          "changed::" NEMO_PREFERENCES_CONTEXT_MENUS_SHOW_ALL_ACTIONS,
                                                          G_CALLBACK (update_toggle_state),
                                                          item);
}
Ejemplo n.º 8
0
static void
ekiga_window_init_contact_list (EkigaWindow *mw)
{
  mw->priv->roster_view = roster_view_gtk_new (mw->priv->presence_core,
                                               mw->priv->account_core);
  gtk_stack_add_named (GTK_STACK (mw->priv->main_stack), mw->priv->roster_view, "contacts");
  gtk_container_child_set (GTK_CONTAINER (mw->priv->main_stack),
                           mw->priv->roster_view,
                           "icon-name", "avatar-default-symbolic", NULL);

  g_object_ref (mw->priv->roster_view);

  g_signal_connect (mw->priv->roster_view, "actions-changed",
                    G_CALLBACK (actions_changed_cb), mw);
}
static void
add_stack_page (CcBluetoothPanel *self,
		const char       *message,
		const char       *explanation,
		const char       *name)
{
	GtkWidget *label, *image, *box;
	char *str;

	box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_set (G_OBJECT (box), "margin-top", 64, "margin-bottom", 64, NULL);

	if (g_str_equal (name, BLUETOOTH_AIRPLANE_PAGE) ||
	    g_str_equal (name, BLUETOOTH_HW_AIRPLANE_PAGE)) {
		image = gtk_image_new_from_icon_name ("airplane-mode-symbolic",
						      GTK_ICON_SIZE_DIALOG);
	} else {
		image = gtk_image_new_from_icon_name ("bluetooth-active-symbolic",
						      GTK_ICON_SIZE_DIALOG);
	}
	gtk_image_set_pixel_size (GTK_IMAGE (image), 192);
	gtk_style_context_add_class (gtk_widget_get_style_context (image), "dim-label");
	gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 24);

	str = g_strdup_printf ("<span size=\"larger\" weight=\"bold\">%s</span>", message);
	label = gtk_label_new ("");
	gtk_label_set_markup (GTK_LABEL (label), str);
	g_free (str);
	gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);

	label = gtk_label_new (explanation);
	gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);

	if (g_str_equal (name, BLUETOOTH_AIRPLANE_PAGE)) {
		GtkWidget *button, *alignment;

		button = gtk_button_new_with_label (_("Turn Off Airplane Mode"));
		alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
		gtk_container_add (GTK_CONTAINER (alignment), button);
		g_signal_connect (G_OBJECT (button), "clicked",
				  G_CALLBACK (on_airplane_mode_off_clicked), self);
		gtk_box_pack_start (GTK_BOX (box), alignment, FALSE, FALSE, 24);
	}

	gtk_stack_add_named (GTK_STACK (self->priv->stack), box, name);
	gtk_widget_show_all (box);
}
Ejemplo n.º 10
0
static void
ekiga_window_init_history (EkigaWindow *mw)
{
  boost::shared_ptr<History::Source> history_source = mw->priv->history_source.lock ();
  if (history_source) {
    boost::shared_ptr<History::Book> history_book = history_source->get_book ();

    mw->priv->call_history_view = call_history_view_gtk_new (history_book,
                                                             mw->priv->call_core,
                                                             mw->priv->contact_core);
    gtk_stack_add_named (GTK_STACK (mw->priv->main_stack), mw->priv->call_history_view, "call-history");
    gtk_container_child_set (GTK_CONTAINER (mw->priv->main_stack),
                             mw->priv->call_history_view,
                             "icon-name", "document-open-recent-symbolic", NULL);

    g_signal_connect (mw->priv->call_history_view, "actions-changed",
                      G_CALLBACK (actions_changed_cb), mw);
  }
}
Ejemplo n.º 11
0
static void
ephy_title_box_add_title_bar (EphyTitleBox *title_box)
{
  GtkStyleContext     *context;
  GtkWidget           *box;
  GtkWidget           *hbox;

  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_widget_set_valign (box, GTK_ALIGN_CENTER);
  gtk_widget_show (box);
  gtk_stack_add_named (GTK_STACK (title_box), box, "title-bar");

  title_box->title = gtk_label_new (NULL);
  gtk_widget_show (title_box->title);
  context = gtk_widget_get_style_context (title_box->title);
  gtk_style_context_add_class (context, "title");
  gtk_label_set_line_wrap (GTK_LABEL (title_box->title), FALSE);
  gtk_label_set_single_line_mode (GTK_LABEL (title_box->title), TRUE);
  gtk_label_set_ellipsize (GTK_LABEL (title_box->title), PANGO_ELLIPSIZE_END);
  gtk_box_pack_start (GTK_BOX (box), title_box->title, FALSE, FALSE, 0);

  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
  context = gtk_widget_get_style_context (hbox);
  gtk_style_context_add_class (context, "subtitle");
  gtk_widget_set_halign (hbox, GTK_ALIGN_CENTER);
  gtk_widget_set_valign (hbox, GTK_ALIGN_BASELINE);
  gtk_widget_show (hbox);
  gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);

  title_box->lock_image = gtk_image_new_from_icon_name ("channel-secure-symbolic", GTK_ICON_SIZE_MENU);
  gtk_widget_set_valign (title_box->lock_image, GTK_ALIGN_BASELINE);
  gtk_box_pack_start (GTK_BOX (hbox), title_box->lock_image, FALSE, FALSE, 0);

  title_box->subtitle = gtk_label_new (NULL);
  gtk_widget_set_valign (title_box->subtitle, GTK_ALIGN_BASELINE);
  gtk_widget_show (title_box->subtitle);
  gtk_label_set_line_wrap (GTK_LABEL (title_box->subtitle), FALSE);
  gtk_label_set_single_line_mode (GTK_LABEL (title_box->subtitle), TRUE);
  gtk_label_set_ellipsize (GTK_LABEL (title_box->subtitle), PANGO_ELLIPSIZE_END);
  gtk_box_pack_start (GTK_BOX (hbox), title_box->subtitle, FALSE, FALSE, 0);
}
Ejemplo n.º 12
0
int
main (int argc, char *argv[])
{
  ClutterTimeline *timeline;
  ClutterActor *stage;
  GtkWidget *window, *stack, *clutter;
  GtkWidget *label, *button, *vbox;
  GdkPixbuf *pixbuf;
  SuperOH *oh;
  gint i;
  GError *error;

  error = NULL;
  if (gtk_clutter_init_with_args (&argc, &argv,
                                  NULL,
                                  NULL,
                                  NULL,
                                  &error) != CLUTTER_INIT_SUCCESS)
    {
      if (error)
        {
          g_critical ("Unable to initialize Clutter-GTK: %s", error->message);
          g_error_free (error);
          return EXIT_FAILURE;
        }
      else
        g_error ("Unable to initialize Clutter-GTK");
    }

  /* calling gtk_clutter_init* multiple times should be safe */
  g_assert (gtk_clutter_init (NULL, NULL) == CLUTTER_INIT_SUCCESS);

  pixbuf = gdk_pixbuf_new_from_file (EXAMPLES_DATADIR G_DIR_SEPARATOR_S "redhand.png", NULL);

  if (!pixbuf)
    g_error("pixbuf load failed");

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window), WINWIDTH, WINHEIGHT);
  gtk_window_set_title (GTK_WINDOW (window), "Clutter Embedding");
  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);

  vbox = gtk_grid_new ();
  gtk_orientable_set_orientation (GTK_ORIENTABLE (vbox), GTK_ORIENTATION_VERTICAL);
  gtk_widget_set_hexpand (vbox, TRUE);
  gtk_widget_set_vexpand (vbox, TRUE);
  gtk_container_add (GTK_CONTAINER (window), vbox);

  stack = gtk_stack_new ();
  gtk_container_add (GTK_CONTAINER (vbox), stack);

  label = gtk_label_new ("This is a label in a stack");
  gtk_stack_add_named (GTK_STACK (stack), label, "label");

  clutter = gtk_clutter_embed_new ();
  gtk_stack_add_named (GTK_STACK (stack), clutter, "clutter");
  gtk_widget_realize (clutter);

  stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter));
  clutter_actor_set_background_color (stage, CLUTTER_COLOR_LightSkyBlue);

  label = gtk_label_new ("This is a label");
  gtk_container_add (GTK_CONTAINER (vbox), label);
  gtk_widget_set_hexpand (label, TRUE);

  button = gtk_button_new_with_label ("This is a button...clicky");
  g_signal_connect (button, "clicked", G_CALLBACK (clickity), stack);
  gtk_container_add (GTK_CONTAINER (vbox), button);
  gtk_widget_set_hexpand (button, TRUE);

  button = gtk_button_new_with_mnemonic ("_Fullscreen");
  g_signal_connect (button, "clicked",
                    G_CALLBACK (on_fullscreen),
                    window);
  gtk_container_add (GTK_CONTAINER (vbox), button);
  gtk_widget_set_hexpand (button, TRUE);

  button = gtk_button_new_with_mnemonic ("_Quit");
  g_signal_connect_swapped (button, "clicked",
                            G_CALLBACK (gtk_widget_destroy),
                            window);
  gtk_container_add (GTK_CONTAINER (vbox), button);
  gtk_widget_set_hexpand (button, TRUE);

  oh = g_new (SuperOH, 1);
  oh->stage = stage;

  oh->group = clutter_actor_new ();
  clutter_actor_set_pivot_point (oh->group, 0.5, 0.5);
  
  for (i = 0; i < NHANDS; i++)
    {
      gint x, y, w, h;

      /* Create a texture from pixbuf, then clone in to same resources */
      if (i == 0)
        {
          oh->hand[i] = gtk_clutter_texture_new ();
          gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE (oh->hand[i]), pixbuf, NULL);
        }
      else
        oh->hand[i] = clutter_clone_new (oh->hand[0]);

      /* Place around a circle */
      w = clutter_actor_get_width (oh->hand[0]);
      h = clutter_actor_get_height (oh->hand[0]);

      x = WINWIDTH / 2  + RADIUS * cos (i * M_PI / (NHANDS / 2)) - w / 2;
      y = WINHEIGHT / 2 + RADIUS * sin (i * M_PI / (NHANDS / 2)) - h / 2;

      clutter_actor_set_position (oh->hand[i], x, y);
      clutter_actor_set_pivot_point (oh->hand[i], 0.5, 0.5);

      /* Add to our group group */
      clutter_actor_add_child (oh->group, oh->hand[i]);
    }

  /* Add the group to the stage */
  clutter_actor_add_child (stage, oh->group);

  clutter_actor_add_constraint (oh->group, clutter_align_constraint_new (oh->stage, CLUTTER_ALIGN_BOTH, 0.5));

  g_signal_connect (stage, "button-press-event",
		    G_CALLBACK (input_cb), 
		    oh);
  g_signal_connect (stage, "key-release-event",
		    G_CALLBACK (input_cb),
		    oh);

  gtk_widget_show_all (window);

  /* Create a timeline to manage animation */
  timeline = clutter_timeline_new (6000);
  clutter_timeline_set_repeat_count (timeline, -1);

  /* fire a callback for frame change */
  g_signal_connect (timeline, "new-frame",  G_CALLBACK (frame_cb), oh);

  /* and start it */
  clutter_timeline_start (timeline);

  gtk_main ();

  return 0;
}
Ejemplo n.º 13
0
void gui_init(dt_iop_module_t *self)
{
  self->gui_data = malloc(sizeof(dt_iop_levels_gui_data_t));
  dt_iop_levels_gui_data_t *c = (dt_iop_levels_gui_data_t *)self->gui_data;
  dt_iop_levels_params_t *p = (dt_iop_levels_params_t *)self->params;

  dt_pthread_mutex_init(&c->lock, NULL);

  dt_pthread_mutex_lock(&c->lock);
  c->auto_levels[0] = NAN;
  c->auto_levels[1] = NAN;
  c->auto_levels[2] = NAN;
  dt_pthread_mutex_unlock(&c->lock);

  c->modes = NULL;

  c->mouse_x = c->mouse_y = -1.0;
  c->dragging = 0;
  c->activeToggleButton = NULL;
  c->current_pick = NONE;
  c->last_picked_color = -1;
  for(int i = 0; i < 3; i++)
    for(int j = 0; j < 2; j++) c->pick_xy_positions[i][j] = -1;
  self->widget = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, 5));

  c->mode = dt_bauhaus_combobox_new(self);
  dt_bauhaus_widget_set_label(c->mode, NULL, _("mode"));

  dt_bauhaus_combobox_add(c->mode, C_("mode", "manual"));
  c->modes = g_list_append(c->modes, GUINT_TO_POINTER(LEVELS_MODE_MANUAL));

  dt_bauhaus_combobox_add(c->mode, _("automatic"));
  c->modes = g_list_append(c->modes, GUINT_TO_POINTER(LEVELS_MODE_AUTOMATIC));

  dt_bauhaus_combobox_set_default(c->mode, LEVELS_MODE_MANUAL);
  dt_bauhaus_combobox_set(c->mode, g_list_index(c->modes, GUINT_TO_POINTER(p->mode)));
  gtk_box_pack_start(GTK_BOX(self->widget), c->mode, TRUE, TRUE, 0);

  c->mode_stack = gtk_stack_new();
  gtk_stack_set_homogeneous(GTK_STACK(c->mode_stack),FALSE);
  gtk_box_pack_start(GTK_BOX(self->widget), c->mode_stack, TRUE, TRUE, 0);

  c->area = GTK_DRAWING_AREA(dtgtk_drawing_area_new_with_aspect_ratio(9.0 / 16.0));
  GtkWidget *vbox_manual = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, 5));
  gtk_box_pack_start(GTK_BOX(vbox_manual), GTK_WIDGET(c->area), TRUE, TRUE, 0);

  gtk_widget_set_tooltip_text(GTK_WIDGET(c->area),_("drag handles to set black, gray, and white points. "
                                                    "operates on L channel."));

  gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
                                             | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
                                             | GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK);
  g_signal_connect(G_OBJECT(c->area), "draw", G_CALLBACK(dt_iop_levels_area_draw), self);
  g_signal_connect(G_OBJECT(c->area), "button-press-event", G_CALLBACK(dt_iop_levels_button_press), self);
  g_signal_connect(G_OBJECT(c->area), "button-release-event", G_CALLBACK(dt_iop_levels_button_release), self);
  g_signal_connect(G_OBJECT(c->area), "motion-notify-event", G_CALLBACK(dt_iop_levels_motion_notify), self);
  g_signal_connect(G_OBJECT(c->area), "leave-notify-event", G_CALLBACK(dt_iop_levels_leave_notify), self);
  g_signal_connect(G_OBJECT(c->area), "scroll-event", G_CALLBACK(dt_iop_levels_scroll), self);

  GtkWidget *autobutton = gtk_button_new_with_label(_("auto"));
  gtk_widget_set_tooltip_text(autobutton, _("apply auto levels"));
  gtk_widget_set_size_request(autobutton, -1, DT_PIXEL_APPLY_DPI(24));

  GtkWidget *blackpick = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT);
  gtk_widget_set_tooltip_text(blackpick, _("pick black point from image"));

  GtkWidget *greypick = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT);
  gtk_widget_set_tooltip_text(greypick, _("pick medium gray point from image"));

  GtkWidget *whitepick = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT);
  gtk_widget_set_tooltip_text(whitepick, _("pick white point from image"));

  GdkRGBA color = { 0 };
  color.alpha = 1.0;
  dtgtk_togglebutton_override_color(DTGTK_TOGGLEBUTTON(blackpick), &color);
  color.red = color.green = color.blue = 0.5;
  dtgtk_togglebutton_override_color(DTGTK_TOGGLEBUTTON(greypick), &color);
  color.red = color.green = color.blue = 1.0;
  dtgtk_togglebutton_override_color(DTGTK_TOGGLEBUTTON(whitepick), &color);

  GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(10));
  gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(autobutton), TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(blackpick), TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(greypick), TRUE, TRUE, 0);
  gtk_box_pack_end(GTK_BOX(box), GTK_WIDGET(whitepick), TRUE, TRUE, 0);

  gtk_box_pack_start(GTK_BOX(vbox_manual), box, TRUE, TRUE, 0);

  gtk_widget_show_all(vbox_manual);
  gtk_stack_add_named(GTK_STACK(c->mode_stack), vbox_manual, "manual");

  c->percentile_black = dt_bauhaus_slider_new_with_range(self, 0.0f, 100.0f, .1f, p->percentiles[0], 3);
  gtk_widget_set_tooltip_text(c->percentile_black, _("black percentile"));
  dt_bauhaus_slider_set_format(c->percentile_black, "%.1f%%");
  dt_bauhaus_widget_set_label(c->percentile_black, NULL, _("black"));

  c->percentile_grey = dt_bauhaus_slider_new_with_range(self, 0.0f, 100.0f, .1f, p->percentiles[1], 3);
  gtk_widget_set_tooltip_text(c->percentile_grey, _("gray percentile"));
  dt_bauhaus_slider_set_format(c->percentile_grey, "%.1f%%");
  dt_bauhaus_widget_set_label(c->percentile_grey, NULL, _("gray"));

  c->percentile_white = dt_bauhaus_slider_new_with_range(self, 0.0f, 100.0f, .1f, p->percentiles[2], 3);
  gtk_widget_set_tooltip_text(c->percentile_white, _("white percentile"));
  dt_bauhaus_slider_set_format(c->percentile_white, "%.1f%%");
  dt_bauhaus_widget_set_label(c->percentile_white, NULL, _("white"));

  GtkWidget *vbox_automatic = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, 5));
  gtk_box_pack_start(GTK_BOX(vbox_automatic), GTK_WIDGET(c->percentile_black), FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(vbox_automatic), GTK_WIDGET(c->percentile_grey), FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(vbox_automatic), GTK_WIDGET(c->percentile_white), FALSE, FALSE, 0);

  gtk_widget_show_all(vbox_automatic);
  gtk_stack_add_named(GTK_STACK(c->mode_stack), vbox_automatic, "automatic");

  switch(p->mode)
  {
    case LEVELS_MODE_AUTOMATIC:
      gtk_stack_set_visible_child_name(GTK_STACK(c->mode_stack), "automatic");
      break;
    case LEVELS_MODE_MANUAL:
    default:
      gtk_stack_set_visible_child_name(GTK_STACK(c->mode_stack), "manual");
      break;
  }

  g_signal_connect(G_OBJECT(c->mode), "value-changed", G_CALLBACK(dt_iop_levels_mode_callback), self);
  g_signal_connect(G_OBJECT(c->percentile_black), "value-changed",
                   G_CALLBACK(dt_iop_levels_percentiles_callback), self);
  g_signal_connect(G_OBJECT(c->percentile_grey), "value-changed",
                   G_CALLBACK(dt_iop_levels_percentiles_callback), self);
  g_signal_connect(G_OBJECT(c->percentile_white), "value-changed",
                   G_CALLBACK(dt_iop_levels_percentiles_callback), self);

  g_signal_connect(G_OBJECT(autobutton), "clicked", G_CALLBACK(dt_iop_levels_autoadjust_callback),
                   (gpointer)self);
  g_signal_connect(G_OBJECT(blackpick), "toggled", G_CALLBACK(dt_iop_levels_pick_black_callback), self);
  g_signal_connect(G_OBJECT(greypick), "toggled", G_CALLBACK(dt_iop_levels_pick_grey_callback), self);
  g_signal_connect(G_OBJECT(whitepick), "toggled", G_CALLBACK(dt_iop_levels_pick_white_callback), self);
}
Ejemplo n.º 14
0
static void
photos_view_container_constructed (GObject *object)
{
  PhotosViewContainer *self = PHOTOS_VIEW_CONTAINER (object);
  PhotosViewContainerPrivate *priv = self->priv;
  AtkObject *accessible;
  GAction *action;
  GApplication *app;
  GtkWidget *generic_view;
  GtkWidget *grid;
  PhotosSearchContextState *state;
  gboolean status;
  gint size;

  G_OBJECT_CLASS (photos_view_container_parent_class)->constructed (object);

  app = g_application_get_default ();
  state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));

  accessible = gtk_widget_get_accessible (GTK_WIDGET (self));
  if (accessible != NULL)
    atk_object_set_name (accessible, priv->name);

  priv->model = photos_view_model_new (priv->mode);

  grid = gtk_grid_new ();
  gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
  gtk_stack_add_named (GTK_STACK (self), grid, "view");

  priv->no_results = photos_empty_results_box_new (priv->mode);
  gtk_stack_add_named (GTK_STACK (self), priv->no_results, "no-results");

  priv->error_box = photos_error_box_new ();
  gtk_stack_add_named (GTK_STACK (self), priv->error_box, "error");

  priv->view = gd_main_view_new (GD_MAIN_VIEW_ICON);
  generic_view = gd_main_view_get_generic_view (priv->view);
  size = photos_utils_get_icon_size_unscaled ();
  gtk_icon_view_set_item_width (GTK_ICON_VIEW (generic_view), size + 24);
  gtk_container_add (GTK_CONTAINER (grid), GTK_WIDGET (priv->view));

  gtk_widget_show_all (GTK_WIDGET (self));

  gtk_stack_set_visible_child_full (GTK_STACK (self), "view", GTK_STACK_TRANSITION_TYPE_NONE);

  g_signal_connect_swapped (priv->view, "item-activated", G_CALLBACK (photos_view_container_item_activated), self);
  g_signal_connect_swapped (priv->view,
                            "selection-mode-request",
                            G_CALLBACK (photos_view_container_selection_mode_request),
                            self);
  g_signal_connect_swapped (priv->view,
                            "view-selection-changed",
                            G_CALLBACK (photos_view_container_view_selection_changed),
                            self);

  priv->item_mngr = g_object_ref (state->item_mngr);

  priv->sel_cntrlr = photos_selection_controller_dup_singleton ();
  g_signal_connect_object (priv->sel_cntrlr,
                           "selection-mode-changed",
                           G_CALLBACK (photos_view_container_selection_mode_changed),
                           self,
                           G_CONNECT_SWAPPED);
  photos_view_container_selection_mode_changed (self,
                                                photos_selection_controller_get_selection_mode (priv->sel_cntrlr));

  priv->mode_cntrlr = g_object_ref (state->mode_cntrlr);
  g_signal_connect_object (priv->mode_cntrlr,
                           "window-mode-changed",
                           G_CALLBACK (photos_view_container_window_mode_changed),
                           self,
                           G_CONNECT_SWAPPED);

  priv->remote_mngr = photos_remote_display_manager_dup_singleton ();

  switch (priv->mode)
    {
    case PHOTOS_WINDOW_MODE_COLLECTIONS:
      priv->trk_cntrlr = photos_tracker_collections_controller_dup_singleton ();
      priv->offset_cntrlr = photos_offset_collections_controller_dup_singleton ();
      break;

    case PHOTOS_WINDOW_MODE_FAVORITES:
      priv->trk_cntrlr = photos_tracker_favorites_controller_dup_singleton ();
      priv->offset_cntrlr = photos_offset_favorites_controller_dup_singleton ();
      break;

    case PHOTOS_WINDOW_MODE_OVERVIEW:
      priv->trk_cntrlr = photos_tracker_overview_controller_dup_singleton ();
      priv->offset_cntrlr = photos_offset_overview_controller_dup_singleton ();
      break;

    case PHOTOS_WINDOW_MODE_SEARCH:
      priv->trk_cntrlr = photos_tracker_search_controller_dup_singleton ();
      priv->offset_cntrlr = photos_offset_search_controller_dup_singleton ();
      break;

    case PHOTOS_WINDOW_MODE_NONE:
    case PHOTOS_WINDOW_MODE_EDIT:
    case PHOTOS_WINDOW_MODE_PREVIEW:
    default:
      g_assert_not_reached ();
      break;
    }

  action = g_action_map_lookup_action (G_ACTION_MAP (app), "select-all");
  g_signal_connect_object (action,
                           "activate",
                           G_CALLBACK (photos_view_container_select_all),
                           self,
                           G_CONNECT_SWAPPED);

  action = g_action_map_lookup_action (G_ACTION_MAP (app), "select-none");
  g_signal_connect_object (action,
                           "activate",
                           G_CALLBACK (gd_main_view_unselect_all),
                           priv->view,
                           G_CONNECT_SWAPPED);

  g_signal_connect_object (priv->offset_cntrlr,
                           "count-changed",
                           G_CALLBACK (photos_view_container_count_changed),
                           self,
                           G_CONNECT_SWAPPED);

  g_signal_connect_object (priv->trk_cntrlr,
                           "query-error",
                           G_CALLBACK (photos_view_container_query_error),
                           self,
                           G_CONNECT_SWAPPED);
  g_signal_connect_object (priv->trk_cntrlr,
                           "query-status-changed",
                           G_CALLBACK (photos_view_container_query_status_changed),
                           self,
                           G_CONNECT_SWAPPED);
  photos_tracker_controller_start (priv->trk_cntrlr);

  status = photos_tracker_controller_get_query_status (priv->trk_cntrlr);
  photos_view_container_query_status_changed (self, status);
}
Ejemplo n.º 15
0
GtkWidget *
dsn_config_new (void)
{
	DsnConfigPrivate *priv;
	GtkWidget *dsn;
	GtkWidget *label;
	GtkWidget *sw;
	gchar *title;
	GdaDataModel *model;

	priv = g_new0 (DsnConfigPrivate, 1);
	dsn = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	gtk_widget_show (dsn);
        gtk_container_set_border_width (GTK_CONTAINER (dsn), 6);
	g_object_set_data_full (G_OBJECT (dsn), DSN_CONFIG_DATA, priv,
				(GDestroyNotify) free_private_data);

	/* title */
	title = g_strdup_printf ("<b>%s</b>\n%s", _("Data Sources"),
				 _("Data sources are the means by which database "
				 "connections are identified: all "
				 "the information needed to open a connection to "
				 "a specific database using a 'provider' is referenced using "
				 "a unique name."));
	priv->title = gdaui_bar_new (title);
	g_free (title);

	gdaui_bar_set_icon_from_resource (GDAUI_BAR (priv->title), "/images/gdaui-generic.png");

	gtk_box_pack_start (GTK_BOX (dsn), priv->title, FALSE, FALSE, 0);
	gtk_widget_show (priv->title);

	/* horizontal box for the provider list and its properties */
	GtkWidget *hbox;
	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_box_pack_start (GTK_BOX (dsn), hbox, TRUE, TRUE, 0);

	/* left part */
	GtkWidget *vbox;
	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_size_request (vbox, 150, -1);
	gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);

	/* create the data source list */
	sw = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC,
					GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
	gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);

	model = gda_config_list_dsn ();
	priv->dsn_list = gdaui_raw_grid_new (model);
	gtk_tree_view_move_column_after (GTK_TREE_VIEW (priv->dsn_list),
					 gtk_tree_view_get_column (GTK_TREE_VIEW (priv->dsn_list), 1),
					 gtk_tree_view_get_column (GTK_TREE_VIEW (priv->dsn_list), 2));

	g_object_unref (model);
	g_object_set_data (G_OBJECT (dsn), "grid", priv->dsn_list);
	gdaui_data_proxy_column_set_editable (GDAUI_DATA_PROXY (priv->dsn_list), 0, FALSE);
	gdaui_data_selector_set_column_visible (GDAUI_DATA_SELECTOR (priv->dsn_list), -1, FALSE);
	gdaui_data_selector_set_column_visible (GDAUI_DATA_SELECTOR (priv->dsn_list), 0, TRUE);
	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->dsn_list), FALSE);
	g_object_set (priv->dsn_list, "info-cell-visible", FALSE, NULL);

	gtk_container_add (GTK_CONTAINER (sw), priv->dsn_list);

	g_signal_connect (priv->dsn_list, "selection-changed",
			  G_CALLBACK (list_selection_changed_cb), dsn);
	g_signal_connect (priv->dsn_list, "populate-popup",
			  G_CALLBACK (list_popup_cb), dsn);

	/* add/delete buttons */
	GtkWidget *toolbar;
	toolbar = gtk_toolbar_new ();
	gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_SMALL_TOOLBAR);
	gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), "inline-toolbar");
	gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0);
	GtkToolItem *titem;
	titem = gtk_tool_button_new (NULL, NULL);
	gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (titem), "list-add-symbolic");
	gtk_actionable_set_action_name (GTK_ACTIONABLE (titem), "win.DatasourceNew");
	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), titem, -1);
	titem = gtk_tool_button_new (NULL, NULL);
	gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (titem), "list-remove-symbolic");
	gtk_actionable_set_action_name (GTK_ACTIONABLE (titem), "win.DatasourceDelete");
	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), titem, -1);

	/* create the data source's properties */
	GtkWidget *stack;
	stack = gtk_stack_new ();
	priv->stack = stack;
	gtk_box_pack_start (GTK_BOX (hbox), stack, TRUE, TRUE, 10);

	label = gtk_label_new (_("No data source selected."));
	gtk_stack_add_named (GTK_STACK (stack), label, ST_NOPROP);

	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_stack_add_named (GTK_STACK (stack), vbox, ST_PROP);

	GtkWidget *form;
	form = gdaui_dsn_editor_new ();
	priv->dsn_editor = GDAUI_DSN_EDITOR (form);
	gtk_box_pack_start (GTK_BOX (vbox), form, TRUE, TRUE, 0);
	g_signal_connect (priv->dsn_editor, "changed",
			  G_CALLBACK (dsn_editor_changed_cb), dsn);

	/* action buttons */
	GtkWidget *hbox2;
	hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 6);

	GtkWidget *bbox;
	bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
	gtk_widget_set_hexpand (bbox, TRUE);
	gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_CENTER);
	gtk_box_pack_start (GTK_BOX (hbox2), bbox, FALSE, FALSE, 6);

	GtkWidget *button;
	button = gtk_toggle_button_new_with_label (_("Definition"));
	gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
	priv->view_buttons [GDAUI_DSN_EDITOR_PANE_DEFINITION] = GTK_TOGGLE_BUTTON (button);
	g_signal_connect (button, "toggled",
			  G_CALLBACK (view_toggled_cb), dsn);

	button = gtk_toggle_button_new_with_label (_("Parameters"));
	gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
	priv->view_buttons [GDAUI_DSN_EDITOR_PANE_PARAMS] = GTK_TOGGLE_BUTTON (button);
	g_signal_connect (button, "toggled",
			  G_CALLBACK (view_toggled_cb), dsn);

	button = gtk_toggle_button_new_with_label (_("Authentication"));
	gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
	priv->view_buttons [GDAUI_DSN_EDITOR_PANE_AUTH] = GTK_TOGGLE_BUTTON (button);
	g_signal_connect (button, "toggled",
			  G_CALLBACK (view_toggled_cb), dsn);

	button = gtk_button_new_from_icon_name ("document-save-symbolic", GTK_ICON_SIZE_BUTTON);
	gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
	priv->commit_button = button;
	gtk_widget_set_sensitive (button, FALSE);
	gtk_widget_set_tooltip_text (button, _("Write changes made to the DSN"));
	g_signal_connect (button, "clicked",
			  G_CALLBACK (save_cb), dsn);

	gtk_widget_show_all (hbox);
	return dsn;
}
Ejemplo n.º 16
0
GtkWidget *
do_sidebar (GtkWidget *do_widget)
{
  static GtkWidget *window = NULL;
  GtkWidget *sidebar;
  GtkWidget *stack;
  GtkWidget *box;
  GtkWidget *widget;
  GtkWidget *header;
  const gchar* pages[] = {
    "Welcome to GTK+",
    "GtkStackSidebar Widget",
    "Automatic navigation",
    "Consistent appearance",
    "Scrolling",
    "Page 6",
    "Page 7",
    "Page 8",
    "Page 9",
    NULL
  };
  const gchar *c = NULL;
  guint i;

  if (!window)
    {
      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
      gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
      gtk_widget_set_size_request (window, 500, 350);

      header = gtk_header_bar_new ();
      gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header), TRUE);
      gtk_window_set_titlebar (GTK_WINDOW(window), header);
      gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar");

      g_signal_connect (window, "destroy",
                        G_CALLBACK (gtk_widget_destroyed), &window);

      box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
      sidebar = gtk_stack_sidebar_new ();
      gtk_box_pack_start (GTK_BOX (box), sidebar, FALSE, FALSE);

      stack = gtk_stack_new ();
      gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN);
      gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), GTK_STACK (stack));

      /* Separator between sidebar and stack */
      widget = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
      gtk_box_pack_start (GTK_BOX(box), widget, FALSE, FALSE);

      gtk_box_pack_start (GTK_BOX (box), stack, TRUE, TRUE);

      for (i=0; (c = *(pages+i)) != NULL; i++ )
        {
          if (i == 0)
            {
              widget = gtk_image_new_from_icon_name ("help-about", GTK_ICON_SIZE_MENU);
              gtk_image_set_pixel_size (GTK_IMAGE (widget), 256);
            }
          else
            {
              widget = gtk_label_new (c);
            }
          gtk_stack_add_named (GTK_STACK (stack), widget, c);
          gtk_container_child_set (GTK_CONTAINER (stack), widget, "title", c, NULL);
        }

       gtk_container_add (GTK_CONTAINER (window), box);
    }

  if (!gtk_widget_get_visible (window))
    gtk_widget_show_all (window);
  else
    gtk_widget_destroy (window);

  return window;
}
Ejemplo n.º 17
0
void
Restore_side(GtkWidget *widget, GtkWidget *stack){
    //TODO create GUI
    widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
    static FZ_Restore field;
    
    // widget = gtk_label_new ("Este assistente ira ajuda-lo a\nRestaurar um Backup de um Banco de Dados.");
    GtkWidget *container_label,
              *container_entry,
              *label_all
              ;
    
    /* Label's */
    container_label = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
    gtk_widget_set_halign(container_label, GTK_ALIGN_END);
    gtk_container_add(GTK_CONTAINER(widget), container_label);
    
    /* File */
    label_all = gtk_label_new("Arquivo: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    /* Password */
    label_all = gtk_label_new("Senha Mestre: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    /* New DB */
    label_all = gtk_label_new("Nova Base de Dados: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    
    
    // Entry's
    container_entry = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
    gtk_container_add(GTK_CONTAINER(widget), container_entry);
    gtk_widget_set_hexpand(container_entry, TRUE);
    
    /* File */
    field.chooser = gtk_file_chooser_button_new (_("Select a file"), GTK_FILE_CHOOSER_ACTION_OPEN);
    field.filter = gtk_file_filter_new ();
    
    gtk_file_filter_set_name (field.filter, _("SQL/Dump"));
    gtk_file_filter_add_mime_type(field.filter, "application/sql");
    //gtk_file_filter_add_mime_type(field.filter, "application/octet-stream");
    gtk_file_filter_add_pattern (field.filter, "*.dump");
    //gtk_file_filter_add_pattern (field.filter, "*.sql");
    g_object_ref_sink (field.filter);
    gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (field.chooser), FALSE);
    gtk_file_chooser_set_filter (GTK_FILE_CHOOSER(field.chooser), field.filter);
    gtk_box_pack_start(GTK_BOX(container_entry), field.chooser, FALSE, FALSE, 0);
    
    /* Code Builder or password SuperUser */
    field.entry_pwd=gtk_entry_new();
    gtk_widget_set_tooltip_text(field.entry_pwd, "Digite a senha de Super Usuario.");
    gtk_entry_set_visibility(GTK_ENTRY(field.entry_pwd), FALSE);
    gtk_entry_set_placeholder_text(GTK_ENTRY(field.entry_pwd), "Senha Mestre");
    gtk_box_pack_start(GTK_BOX(container_entry), field.entry_pwd, FALSE, FALSE, 0);
    
    /* Code Builder or password SuperUser */
    field.new_dbname=gtk_entry_new();
    gtk_widget_set_tooltip_text(field.new_dbname, "Digite o nome do Novo banco de dados.");
    gtk_entry_set_placeholder_text(GTK_ENTRY(field.new_dbname), "Nome da Nova Base");
    gtk_box_pack_start(GTK_BOX(container_entry), field.new_dbname, FALSE, FALSE, 0);
    
    //TODO to continue...
    
    gtk_stack_add_named (GTK_STACK (stack), widget, "Restaurar");
    gtk_container_child_set (GTK_CONTAINER (stack), widget, "title", "Restaurar", NULL);
}
Ejemplo n.º 18
0
void gui_init(struct dt_iop_module_t *self)
{
  self->gui_data = malloc(sizeof(dt_iop_exposure_gui_data_t));
  dt_iop_exposure_gui_data_t *g = (dt_iop_exposure_gui_data_t *)self->gui_data;
  dt_iop_exposure_params_t *p = (dt_iop_exposure_params_t *)self->params;

  g->modes = NULL;
  g->deflicker_histogram_sources = NULL;

  g->deflicker_histogram = NULL;

  dt_pthread_mutex_init(&g->lock, NULL);

  /* register hooks with current dev so that  histogram
     can interact with this module.
   */
  darktable.develop->proxy.exposure.module = self;
  darktable.develop->proxy.exposure.set_white = dt_iop_exposure_set_white;
  darktable.develop->proxy.exposure.get_white = dt_iop_exposure_get_white;
  darktable.develop->proxy.exposure.set_black = dt_iop_exposure_set_black;
  darktable.develop->proxy.exposure.get_black = dt_iop_exposure_get_black;

  self->request_color_pick = DT_REQUEST_COLORPICK_OFF;

  self->widget = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE));

  g->mode = dt_bauhaus_combobox_new(self);
  dt_bauhaus_widget_set_label(g->mode, NULL, _("mode"));

  dt_bauhaus_combobox_add(g->mode, C_("mode", "manual"));
  g->modes = g_list_append(g->modes, GUINT_TO_POINTER(EXPOSURE_MODE_MANUAL));

  dt_bauhaus_combobox_add(g->mode, _("automatic"));
  g->modes = g_list_append(g->modes, GUINT_TO_POINTER(EXPOSURE_MODE_DEFLICKER));

  dt_bauhaus_combobox_set_default(g->mode, 0);
  dt_bauhaus_combobox_set(g->mode, g_list_index(g->modes, GUINT_TO_POINTER(p->mode)));

  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->mode), TRUE, TRUE, 0);

  g->black = dt_bauhaus_slider_new_with_range(self, -0.1, 0.1, .001, p->black, 4);
  g_object_set(G_OBJECT(g->black), "tooltip-text", _("adjust the black level"), (char *)NULL);
  dt_bauhaus_slider_set_format(g->black, "%.4f");
  dt_bauhaus_widget_set_label(g->black, NULL, _("black"));
  dt_bauhaus_slider_enable_soft_boundaries(g->black, -1.0, 1.0);
  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->black), TRUE, TRUE, 0);

  g->mode_stack = gtk_stack_new();
  gtk_stack_set_homogeneous(GTK_STACK(g->mode_stack),FALSE);
  gtk_box_pack_start(GTK_BOX(self->widget), g->mode_stack, TRUE, TRUE, 0);

  GtkWidget *vbox_manual = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE));

  g->exposure = dt_bauhaus_slider_new_with_range(self, -3.0, 3.0, .02, p->exposure, 3);
  g_object_set(G_OBJECT(g->exposure), "tooltip-text", _("adjust the exposure correction"), (char *)NULL);
  dt_bauhaus_slider_set_format(g->exposure, "%.2fEV");
  dt_bauhaus_widget_set_label(g->exposure, NULL, _("exposure"));
  dt_bauhaus_slider_enable_soft_boundaries(g->exposure, -18.0, 18.0);
  gtk_box_pack_start(GTK_BOX(vbox_manual), GTK_WIDGET(g->exposure), TRUE, TRUE, 0);

  GtkBox *hbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));

  g->autoexp = GTK_CHECK_BUTTON(gtk_check_button_new_with_label(_("auto")));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->autoexp), FALSE);
  gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(g->autoexp), FALSE, TRUE, 0);

  g->autoexpp = dt_bauhaus_slider_new_with_range(self, 0.0, 0.2, .001, 0.01, 3);
  g_object_set(G_OBJECT(g->autoexpp), "tooltip-text", _("percentage of bright values clipped out"),
               (char *)NULL);
  gtk_widget_set_sensitive(GTK_WIDGET(g->autoexpp), TRUE);
  gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(g->autoexpp), TRUE, TRUE, 0);

  gtk_box_pack_start(GTK_BOX(vbox_manual), GTK_WIDGET(hbox), TRUE, TRUE, 0);
  gtk_widget_show_all(vbox_manual);
  gtk_stack_add_named(GTK_STACK(g->mode_stack), vbox_manual, "manual");

  GtkWidget *vbox_deflicker = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE));

  g->deflicker_percentile = dt_bauhaus_slider_new_with_range(self, 0, 100, .01, p->deflicker_percentile, 3);
  // FIXME: this needs a better tooltip!
  g_object_set(G_OBJECT(g->deflicker_percentile), "tooltip-text", _("percentile"), (char *)NULL);
  dt_bauhaus_slider_set_format(g->deflicker_percentile, "%.2f%%");
  dt_bauhaus_widget_set_label(g->deflicker_percentile, NULL, _("percentile"));
  gtk_box_pack_start(GTK_BOX(vbox_deflicker), GTK_WIDGET(g->deflicker_percentile), TRUE, TRUE, 0);

  g->deflicker_target_level
      = dt_bauhaus_slider_new_with_range(self, -18.0, 18.0, .01, p->deflicker_target_level, 3);
  g_object_set(G_OBJECT(g->deflicker_target_level), "tooltip-text", _("target level"), (char *)NULL);
  dt_bauhaus_slider_set_format(g->deflicker_target_level, "%.2fEV");
  dt_bauhaus_widget_set_label(g->deflicker_target_level, NULL, _("target level"));
  gtk_box_pack_start(GTK_BOX(vbox_deflicker), GTK_WIDGET(g->deflicker_target_level), TRUE, TRUE, 0);

  g->deflicker_histogram_source = dt_bauhaus_combobox_new(self);
  dt_bauhaus_widget_set_label(g->deflicker_histogram_source, NULL, _("histogram of"));

  dt_bauhaus_combobox_add(g->deflicker_histogram_source, _("pre-processed image"));
  g->deflicker_histogram_sources
      = g_list_append(g->deflicker_histogram_sources, GUINT_TO_POINTER(DEFLICKER_HISTOGRAM_SOURCE_THUMBNAIL));

  dt_bauhaus_combobox_add(g->deflicker_histogram_source, _("source raw data"));
  g->deflicker_histogram_sources = g_list_append(g->deflicker_histogram_sources,
                                                 GUINT_TO_POINTER(DEFLICKER_HISTOGRAM_SOURCE_SOURCEFILE));

  dt_bauhaus_combobox_set_default(g->deflicker_histogram_source, DEFLICKER_HISTOGRAM_SOURCE_THUMBNAIL);
  dt_bauhaus_combobox_set(g->deflicker_histogram_source,
                          g_list_index(g->modes, GUINT_TO_POINTER(p->deflicker_histogram_source)));
  gtk_box_pack_start(GTK_BOX(vbox_deflicker), GTK_WIDGET(g->deflicker_histogram_source), TRUE, TRUE, 0);

  GtkBox *hbox1 = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
  GtkLabel *label = GTK_LABEL(gtk_label_new(_("computed EC: ")));
  gtk_box_pack_start(GTK_BOX(hbox1), GTK_WIDGET(label), FALSE, FALSE, 0);

  g->deflicker_used_EC = GTK_LABEL(gtk_label_new("")); // This gets filled in by process
  g_object_set(G_OBJECT(g->deflicker_used_EC), "tooltip-text",
               _("what exposure correction have actually been used"), (char *)NULL);
  gtk_box_pack_start(GTK_BOX(hbox1), GTK_WIDGET(g->deflicker_used_EC), FALSE, FALSE, 0);

  dt_pthread_mutex_lock(&g->lock);
  g->deflicker_computed_exposure = NAN;
  dt_pthread_mutex_unlock(&g->lock);

  gtk_box_pack_start(GTK_BOX(vbox_deflicker), GTK_WIDGET(hbox1), FALSE, FALSE, 0);

  gtk_widget_show_all(vbox_deflicker);
  gtk_stack_add_named(GTK_STACK(g->mode_stack), vbox_deflicker, "deflicker");

  g_signal_connect(G_OBJECT(g->mode), "value-changed", G_CALLBACK(mode_callback), self);
  g_signal_connect(G_OBJECT(g->black), "value-changed", G_CALLBACK(black_callback), self);
  g_signal_connect(G_OBJECT(g->exposure), "value-changed", G_CALLBACK(exposure_callback), self);
  g_signal_connect(G_OBJECT(g->autoexpp), "value-changed", G_CALLBACK(autoexpp_callback), self);
  g_signal_connect(G_OBJECT(g->autoexp), "toggled", G_CALLBACK(autoexp_callback), self);
  g_signal_connect(G_OBJECT(g->deflicker_percentile), "value-changed", G_CALLBACK(deflicker_params_callback),
                   self);
  g_signal_connect(G_OBJECT(g->deflicker_target_level), "value-changed",
                   G_CALLBACK(deflicker_params_callback), self);
  g_signal_connect(G_OBJECT(g->deflicker_histogram_source), "value-changed",
                   G_CALLBACK(deflicker_histogram_source_callback), self);
  g_signal_connect(G_OBJECT(self->widget), "draw", G_CALLBACK(draw), self);
}
Ejemplo n.º 19
0
void
Advanced_side(GtkWidget *widget, GtkWidget *stack){
    widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
    static FZ_Advanced field;
    
    // widget = gtk_label_new ("Isto ira configurar as info de conexão.");
    
    GtkWidget *container_label,
              *container_entry,
              *label_all,
              *button_refresh,
              *container_all
              ;
    GtkAdjustment *adjustment;
    /* Create an adjustment representing an adjustable bounded value */
    //adjustment = gtk_adjustment_new (5432, 0, G_MAXDOUBLE, 1, 0, 0);
    adjustment = gtk_adjustment_new (5432, 0, 100000, 1, 0, 0);
    
    container_all = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
    gtk_container_add(GTK_CONTAINER(widget), container_all);
    //
    // Label's
    //
    container_label = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
    gtk_widget_set_halign(container_label, GTK_ALIGN_END);
    gtk_container_add(GTK_CONTAINER(container_all), container_label);
    
    /* Host Server IP */
    label_all = gtk_label_new("IP: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    /* Host Server Port */
    label_all = gtk_label_new("Porta: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    /* Host Server User */
    label_all = gtk_label_new("Usuario: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    /* Host Server PassWord */
    label_all = gtk_label_new("Senha: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    //
    // Entry's
    //
    container_entry = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
    gtk_container_add(GTK_CONTAINER(container_all), container_entry);
    gtk_widget_set_hexpand(container_entry, TRUE);
    
    /* Host Server IP */
    field.Host = gtk_entry_new ();
    gtk_widget_set_tooltip_text(field.Host, "IP do Servidor do banco de dados...\nEX:localhost");
    gtk_entry_set_placeholder_text(GTK_ENTRY(field.Host), "EX: localhost");
    gtk_box_pack_start(GTK_BOX(container_entry), field.Host, FALSE, FALSE, 0);
    
    /* Host Server Porta */
    //field.Port = gtk_entry_new ();
    field.Port = gtk_spin_button_new (adjustment, 1, 0);
    gtk_widget_set_tooltip_text(field.Port, "Porta do Servidor do banco de dados...\nEX: 5432");
    gtk_entry_set_placeholder_text(GTK_ENTRY(field.Port), "EX: 5432");
    gtk_box_pack_start(GTK_BOX(container_entry), field.Port, FALSE, FALSE, 0);
    
    /* Host Server User */
    field.Login = gtk_entry_new ();
    gtk_widget_set_tooltip_text(field.Login, "Usuario do banco de dados...");
    gtk_entry_set_placeholder_text(GTK_ENTRY(field.Login), "Usuario");
    gtk_box_pack_start(GTK_BOX(container_entry), field.Login, FALSE, FALSE, 0);
    
    /* Host Server PassWord */
    field.PassWord = gtk_entry_new ();
    gtk_widget_set_tooltip_text(field.PassWord, "Senha do Usuario do banco de dados...");
    gtk_entry_set_placeholder_text(GTK_ENTRY(field.PassWord), "Senha");
    gtk_entry_set_visibility(GTK_ENTRY(field.PassWord), FALSE);
    gtk_box_pack_start(GTK_BOX(container_entry), field.PassWord, FALSE, FALSE, 0);
    
    /* Buttons */
    //container_button_all = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
    //gtk_container_add(GTK_CONTAINER(container_all), container_button_all);

    field.button_load = gtk_button_new_with_label("Ler");
    gtk_box_pack_start(GTK_BOX(widget), field.button_load, FALSE, FALSE, 0);
    
    field.button_save = gtk_button_new_with_label("Salvar");
    gtk_box_pack_start(GTK_BOX(widget), field.button_save, FALSE, FALSE, 0);
    
    gtk_stack_add_named (GTK_STACK (stack), widget, "Avançado");
    gtk_container_child_set (GTK_CONTAINER (stack), widget, "title", "Avançado", NULL);
    
    /* Sinais */
    
    g_signal_connect (GTK_BUTTON (field.button_load),
                    "clicked", 
                    G_CALLBACK (button_load_conf_clicked), 
                    (gpointer) &field);
    
    g_signal_connect (GTK_BUTTON (field.button_save),
                    "clicked", 
                    G_CALLBACK (button_save_conf_clicked), 
                    (gpointer) &field);
}
Ejemplo n.º 20
0
static void
gtk_shortcuts_window_init (GtkShortcutsWindow *self)
{
  GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self);
  GtkToggleButton *search_button;
  GtkBox *menu_box;
  GtkBox *box;
  GtkArrow *arrow;
  GtkWidget *scroller;
  GtkWidget *label;
  GtkWidget *empty;
  PangoAttrList *attributes;

  gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
  gtk_window_set_type_hint (GTK_WINDOW (self), GDK_WINDOW_TYPE_HINT_DIALOG);

  g_signal_connect (self, "key-press-event",
                    G_CALLBACK (window_key_press_event_cb), NULL);

  priv->keywords = g_hash_table_new_full (NULL, NULL, NULL, g_free);
  priv->search_items_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);

  priv->search_text_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
  priv->search_image_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);

  priv->header_bar = g_object_new (GTK_TYPE_HEADER_BAR,
                                   "show-close-button", TRUE,
                                   "visible", TRUE,
                                   NULL);
  gtk_window_set_titlebar (GTK_WINDOW (self), GTK_WIDGET (priv->header_bar));

  search_button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
                                "child", g_object_new (GTK_TYPE_IMAGE,
                                                       "visible", TRUE,
                                                       "icon-name", "edit-find-symbolic",
                                                       NULL),
                                "visible", TRUE,
                                NULL);
  gtk_container_add (GTK_CONTAINER (priv->header_bar), GTK_WIDGET (search_button));

  priv->main_box = g_object_new (GTK_TYPE_BOX,
                           "orientation", GTK_ORIENTATION_VERTICAL,
                           "visible", TRUE,
                           NULL);
  GTK_CONTAINER_CLASS (gtk_shortcuts_window_parent_class)->add (GTK_CONTAINER (self), GTK_WIDGET (priv->main_box));

  priv->search_bar = g_object_new (GTK_TYPE_SEARCH_BAR,
                                   "visible", TRUE,
                                   NULL);
  g_object_bind_property (priv->search_bar, "search-mode-enabled",
                          search_button, "active",
                          G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
  gtk_container_add (GTK_CONTAINER (priv->main_box), GTK_WIDGET (priv->search_bar));

  priv->stack = g_object_new (GTK_TYPE_STACK,
                              "expand", TRUE,
                              "homogeneous", TRUE,
                              "transition-type", GTK_STACK_TRANSITION_TYPE_CROSSFADE,
                              "visible", TRUE,
                              NULL);
  gtk_container_add (GTK_CONTAINER (priv->main_box), GTK_WIDGET (priv->stack));

  priv->title_stack = g_object_new (GTK_TYPE_STACK,
                                    "visible", TRUE,
                                    NULL);
  gtk_header_bar_set_custom_title (priv->header_bar, GTK_WIDGET (priv->title_stack));

  label = gtk_label_new (_("Shortcuts"));
  gtk_widget_show (label);
  gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_TITLE);
  gtk_stack_add_named (priv->title_stack, label, "title");

  label = gtk_label_new (_("Search Results"));
  gtk_widget_show (label);
  gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_TITLE);
  gtk_stack_add_named (priv->title_stack, label, "search");

  priv->menu_button = g_object_new (GTK_TYPE_MENU_BUTTON,
                                    "focus-on-click", FALSE,
                                    "visible", TRUE,
                                    "relief", GTK_RELIEF_NONE,
                                    NULL);
  gtk_stack_add_named (priv->title_stack, GTK_WIDGET (priv->menu_button), "sections");

  menu_box = g_object_new (GTK_TYPE_BOX,
                           "orientation", GTK_ORIENTATION_HORIZONTAL,
                           "spacing", 6,
                           "visible", TRUE,
                           NULL);
  gtk_container_add (GTK_CONTAINER (priv->menu_button), GTK_WIDGET (menu_box));

  priv->menu_label = g_object_new (GTK_TYPE_LABEL,
                                   "visible", TRUE,
                                   NULL);
  gtk_container_add (GTK_CONTAINER (menu_box), GTK_WIDGET (priv->menu_label));

  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
  arrow = g_object_new (GTK_TYPE_ARROW,
                        "arrow-type", GTK_ARROW_DOWN,
                        "visible", TRUE,
                        NULL);
  gtk_container_add (GTK_CONTAINER (menu_box), GTK_WIDGET (arrow));
  G_GNUC_END_IGNORE_DEPRECATIONS;

  priv->popover = g_object_new (GTK_TYPE_POPOVER,
                                "border-width", 6,
                                "relative-to", priv->menu_button,
                                "position", GTK_POS_BOTTOM,
                                NULL);
  gtk_menu_button_set_popover (priv->menu_button, GTK_WIDGET (priv->popover));

  priv->list_box = g_object_new (GTK_TYPE_LIST_BOX,
                                 "selection-mode", GTK_SELECTION_NONE,
                                 "visible", TRUE,
                                 NULL);
  g_signal_connect_object (priv->list_box,
                           "row-activated",
                           G_CALLBACK (gtk_shortcuts_window__list_box__row_activated),
                           self,
                           G_CONNECT_SWAPPED);
  gtk_container_add (GTK_CONTAINER (priv->popover), GTK_WIDGET (priv->list_box));

  priv->search_entry = GTK_SEARCH_ENTRY (gtk_search_entry_new ());
  gtk_widget_show (GTK_WIDGET (priv->search_entry));
  gtk_container_add (GTK_CONTAINER (priv->search_bar), GTK_WIDGET (priv->search_entry));
  g_object_set (priv->search_entry,
                "placeholder-text", _("Search Shortcuts"),
                "width-chars", 40,
                NULL);
  g_signal_connect_object (priv->search_entry,
                           "search-changed",
                           G_CALLBACK (gtk_shortcuts_window__entry__changed),
                           self,
                           G_CONNECT_SWAPPED);
  g_signal_connect_object (priv->search_bar,
                           "notify::search-mode-enabled",
                           G_CALLBACK (gtk_shortcuts_window__search_mode__changed),
                           self,
                           G_CONNECT_SWAPPED);

  scroller = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
                           "visible", TRUE,
                           NULL);
  box = g_object_new (GTK_TYPE_BOX,
                      "border-width", 24,
                      "halign", GTK_ALIGN_CENTER,
                      "spacing", 24,
                      "orientation", GTK_ORIENTATION_VERTICAL,
                      "visible", TRUE,
                      NULL);
  gtk_container_add (GTK_CONTAINER (scroller), GTK_WIDGET (box));
  gtk_stack_add_named (priv->stack, scroller, "internal-search");

  priv->search_shortcuts = g_object_new (GTK_TYPE_BOX,
                                         "halign", GTK_ALIGN_CENTER,
                                         "spacing", 6,
                                         "orientation", GTK_ORIENTATION_VERTICAL,
                                         "visible", TRUE,
                                         NULL);
  gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (priv->search_shortcuts));

  priv->search_gestures = g_object_new (GTK_TYPE_BOX,
                                        "halign", GTK_ALIGN_CENTER,
                                        "spacing", 6,
                                        "orientation", GTK_ORIENTATION_VERTICAL,
                                        "visible", TRUE,
                                        NULL);
  gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (priv->search_gestures));

  empty = g_object_new (GTK_TYPE_GRID,
                        "visible", TRUE,
                        "row-spacing", 12,
                        "margin", 12,
                        "hexpand", TRUE,
                        "vexpand", TRUE,
                        "halign", GTK_ALIGN_CENTER,
                        "valign", GTK_ALIGN_CENTER,
                        NULL);
  gtk_style_context_add_class (gtk_widget_get_style_context (empty), GTK_STYLE_CLASS_DIM_LABEL);
  gtk_grid_attach (GTK_GRID (empty),
                   g_object_new (GTK_TYPE_IMAGE,
                                 "visible", TRUE,
                                 "icon-name", "edit-find-symbolic",
                                 "pixel-size", 72,
                                 NULL),
                   0, 0, 1, 1);
  attributes = pango_attr_list_new ();
  pango_attr_list_insert (attributes, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
  pango_attr_list_insert (attributes, pango_attr_scale_new (1.44));
  label = g_object_new (GTK_TYPE_LABEL,
                        "visible", TRUE,
                        "label", _("No Results Found"),
                        "attributes", attributes,
                        NULL);
  pango_attr_list_unref (attributes);
  gtk_grid_attach (GTK_GRID (empty), label, 0, 1, 1, 1);
  label = g_object_new (GTK_TYPE_LABEL,
                        "visible", TRUE,
                        "label", _("Try a different search"),
                        NULL);
  gtk_grid_attach (GTK_GRID (empty), label, 0, 2, 1, 1);

  gtk_stack_add_named (priv->stack, empty, "no-search-results");

  g_signal_connect_object (priv->stack, "notify::visible-child",
                           G_CALLBACK (update_title_stack), self, G_CONNECT_SWAPPED);

}
Ejemplo n.º 21
0
void
Welcome_side(GtkWidget *widget, GtkWidget *stack){
    widget = gtk_label_new ("Este assistente ira ajuda-lo a Gerenciar um Banco de Dados Mais Rapido e melhor.");
    gtk_stack_add_named (GTK_STACK (stack), widget, "Bem-vindos");
    gtk_container_child_set (GTK_CONTAINER (stack), widget, "title", "Bem-vindos", NULL);
}
Ejemplo n.º 22
0
void
Create_side(GtkWidget *widget, GtkWidget *stack){
    widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
    //widget = gtk_label_new ("Este assistente ira ajuda-lo a Criar um Banco de Dados.");
    
    static FZ_Create field;// caso não for static da pau
    
    GtkWidget *container_all,
              *container_label,
              *container_entry,
              *label_all
              ;
    // Container all
    container_all = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
    gtk_container_add(GTK_CONTAINER(widget), container_all);
    
    // Label's
    container_label = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
    gtk_widget_set_halign(container_label, GTK_ALIGN_END);
    gtk_container_add(GTK_CONTAINER(container_all), container_label);
    
    /* nome do DB */
    label_all = gtk_label_new ("Novo Banco de Dados: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    /* Code Builder or password SuperUser */
    label_all = gtk_label_new ("Senha Master: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    /* ROOT Password */
    label_all = gtk_label_new ("Senha do Administrador: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    
    
    label_all = gtk_label_new ("Confirme a Senha do Administrador: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    
    // Entry's
    container_entry = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
    gtk_container_add(GTK_CONTAINER(container_all), container_entry);
    gtk_widget_set_hexpand(container_entry, TRUE);
    
    /* nome do DB */
    field.entry_db=gtk_entry_new();
    gtk_widget_set_tooltip_text(field.entry_db, "Digite o Novo Nome do Banco de Dados.");
    gtk_entry_set_placeholder_text(GTK_ENTRY(field.entry_db), "Banco de Dados");
    gtk_box_pack_start(GTK_BOX(container_entry), field.entry_db, FALSE, FALSE, 0);
    
    /* Code Builder or password SuperUser */
    field.entry_pwd=gtk_entry_new();
    gtk_widget_set_tooltip_text(field.entry_pwd, "Digite a senha de Super Usuario.");
    gtk_entry_set_visibility(GTK_ENTRY(field.entry_pwd), FALSE);
    gtk_entry_set_placeholder_text(GTK_ENTRY(field.entry_pwd), "Senha Mestre");
    gtk_box_pack_start(GTK_BOX(container_entry), field.entry_pwd, FALSE, FALSE, 0);
    
    /* ROOT Password */
    field.rootpwd = gtk_entry_new();
    gtk_widget_set_tooltip_text(field.rootpwd, "Digite a senha de Adimistrador do Novo Banco de Dados (login:admin).");
    gtk_entry_set_placeholder_text(GTK_ENTRY(field.rootpwd), "Senha do Administrador");
    gtk_entry_set_visibility(GTK_ENTRY(field.rootpwd), FALSE);
    gtk_box_pack_start(GTK_BOX(container_entry), field.rootpwd, FALSE, FALSE, 0);
    
    /* ROOT Password Reply */
    field.rootpwd_reply = gtk_entry_new();
    gtk_widget_set_tooltip_text(field.rootpwd_reply, "Digite a senha de Adimistrador do Novo Banco de Dados (login:admin).");
    gtk_entry_set_placeholder_text(GTK_ENTRY(field.rootpwd_reply), "Confirme a Senha");
    gtk_entry_set_visibility(GTK_ENTRY(field.rootpwd_reply), FALSE);
    gtk_box_pack_start(GTK_BOX(container_entry), field.rootpwd_reply, FALSE, FALSE, 0);
    
    
    
    /* Demo info preload */
    field.demo = gtk_check_button_new_with_label("Demostração?");
    gtk_widget_set_halign(field.demo, GTK_ALIGN_CENTER);
    gtk_widget_set_tooltip_text(field.demo, "Se na criação as informações de Demostração serão instaladas.");
    gtk_container_add(GTK_CONTAINER(widget), field.demo);
    
    
    
    
    /* Botão de Criar */
    field.button = gtk_button_new_with_label ("Criar");
    gtk_widget_set_tooltip_text(field.button, "Sera ativado quando as Informações estiverem corretas.");
    gtk_widget_set_sensitive (field.button, FALSE);// disable button
    g_signal_connect (GTK_BUTTON (field.button),
                    "clicked", 
                    G_CALLBACK (button_create_clicked), 
                    (gpointer) &field);
    gtk_container_add( GTK_CONTAINER(widget) ,field.button );
    gtk_stack_add_named (GTK_STACK (stack), widget, "Criar");
    gtk_container_child_set (GTK_CONTAINER (stack), widget, "title", "Criar", NULL);
    
    /* Validate Focus */
    
    g_signal_connect (GTK_ENTRY (field.entry_db),
                    "focus-out-event", 
                    G_CALLBACK (validate_create_focus), 
                    (gpointer) &field);
    
    g_signal_connect (GTK_ENTRY (field.entry_pwd),
                    "focus-out-event", 
                    G_CALLBACK (validate_create_focus), 
                    (gpointer) &field);
    
    g_signal_connect (GTK_ENTRY (field.rootpwd),
                    "focus-out-event", 
                    G_CALLBACK (validate_create_focus), 
                    (gpointer) &field);
    
    g_signal_connect (GTK_ENTRY (field.rootpwd_reply),
                    "focus-out-event", 
                    G_CALLBACK (validate_create_focus), 
                    (gpointer) &field);
}
Ejemplo n.º 23
0
/* Gobj */
static void
bjb_window_base_constructed (GObject *obj)
{
  BjbWindowBase *self = BJB_WINDOW_BASE (obj);
  BjbWindowBasePriv *priv;
  gboolean maximized;
  const gint32 *position;
  const gint32 *size;
  gsize n_elements;
  GVariant *variant;

  G_OBJECT_CLASS (bjb_window_base_parent_class)->constructed (obj);

  priv = self->priv;
  priv->settings = bjb_app_get_settings ((gpointer) g_application_get_default ());




  gtk_window_set_position (GTK_WINDOW (self),GTK_WIN_POS_CENTER);
  gtk_window_set_title (GTK_WINDOW (self), _(BIJIBEN_MAIN_WIN_TITLE));

  variant = g_settings_get_value (G_SETTINGS (priv->settings), "window-size");
  size = g_variant_get_fixed_array (variant, &n_elements, sizeof (gint32));
  if (n_elements == 2)
    gtk_window_set_default_size (GTK_WINDOW (self), size[0], size[1]);

  g_variant_unref (variant);

  variant = g_settings_get_value (G_SETTINGS (priv->settings), "window-position");
  position = g_variant_get_fixed_array (variant, &n_elements, sizeof (gint32));
  if (n_elements == 2)
    gtk_window_move (GTK_WINDOW (self), position[0], position[1]);

  g_variant_unref (variant);

  maximized = g_settings_get_boolean (G_SETTINGS (priv->settings), "window-maximized");
  if (maximized)
    gtk_window_maximize (GTK_WINDOW (self));

  /*  We probably want to offer a no entry window at first (startup) */
  priv->entry = NULL ;

  priv->controller = bjb_controller_new
    (bijiben_get_manager (BIJIBEN_APPLICATION(g_application_get_default())),
     GTK_WINDOW (obj),
     priv->entry );

  /* Shared toolbar */
  priv->view = bjb_main_view_new (GTK_WIDGET (obj), priv->controller);
  priv->main_toolbar = bjb_main_toolbar_new (priv->view, priv->controller);
  gtk_window_set_titlebar (GTK_WINDOW (self), GTK_WIDGET (priv->main_toolbar));

  /* Search entry toolbar */
  priv->search_bar = bjb_search_toolbar_new (GTK_WIDGET (obj), priv->controller);
  gtk_box_pack_start (GTK_BOX (priv->vbox), GTK_WIDGET (priv->search_bar), FALSE, FALSE, 0);

  /* UI : stack for different views */
  priv->stack = GTK_STACK (gtk_stack_new ());
  gtk_box_pack_start (GTK_BOX (priv->vbox), GTK_WIDGET (priv->stack), TRUE, TRUE, 0);

  priv->spinner = gtk_spinner_new ();
  gtk_stack_add_named (priv->stack, priv->spinner, "spinner");
  gtk_stack_set_visible_child_name (priv->stack, "spinner");
  gtk_widget_show (priv->spinner);
  gtk_spinner_start (GTK_SPINNER (priv->spinner));

  priv->no_note = bjb_empty_results_box_new ();
  gtk_stack_add_named (priv->stack, priv->no_note, "empty");

  gtk_stack_add_named (priv->stack, GTK_WIDGET (priv->view), "main-view");
  gtk_widget_show (GTK_WIDGET (priv->stack));


  /* Connection to window signals */

  g_signal_connect (GTK_WIDGET (self),
                    "destroy",
                    G_CALLBACK (bjb_window_base_destroy),
                    self);

  g_signal_connect (self,
                    "window-state-event",
                    G_CALLBACK (bjb_application_window_state_changed),
                    priv->settings);

  g_signal_connect (self,
                    "configure-event",
                    G_CALLBACK (bjb_application_window_configured),
                    self);

  /* Keys */

  g_signal_connect (GTK_WIDGET (self),
                    "key-press-event",
                    G_CALLBACK(on_key_pressed_cb),
		    self);

  /* If a note is requested at creation, show it
   * This is a specific type of window not associated with any view */
  if (priv->note == NULL)
  {
    bjb_window_base_switch_to (self, BJB_WINDOW_BASE_MAIN_VIEW);
  }

  else
  {
    priv->detached = TRUE;
    bjb_window_base_switch_to_item (self, BIJI_ITEM (priv->note));
  }


  /* For some reason, do not gtk_widget_show _self_
   * or gtk_application_get_menu_bar will run,
   * fire a warning, while app menu will not show up
   * you have been warned!
   *
   * This is probably due to the fact that,
   * at startup, we still are
   * inside... drums... gapplication startup () */
  gtk_widget_show (priv->vbox);
}
Ejemplo n.º 24
0
void
Delete_side(GtkWidget *widget, GtkWidget *stack){
    widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
    static FZ_Delete field;
    // widget = gtk_label_new ("Este assistente ira ajuda-lo a\nDeletar um Banco de Dados.");
    
    GtkWidget *container_label,
              *container_entry,
              *label_all,
              *button_refresh
              ;
    
    /* Label's */
    container_label = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
    gtk_widget_set_halign(container_label, GTK_ALIGN_END);
    gtk_container_add(GTK_CONTAINER(widget), container_label);
    
    /* Banco de Dados */
    label_all = gtk_label_new("Banco de Dados: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    /* Senha Mestre */
    label_all = gtk_label_new("Senha Master: ");
    gtk_widget_set_halign(label_all, GTK_ALIGN_END);
    gtk_box_pack_start(GTK_BOX(container_label), label_all, FALSE, FALSE, 5);
    
    /* Button Refresh */
    button_refresh = gtk_button_new_with_label("Atualizar");
    gtk_box_pack_start(GTK_BOX(container_label), button_refresh, FALSE, FALSE, 0);
    
    
    // Entry's
    container_entry = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
    gtk_container_add(GTK_CONTAINER(widget), container_entry);
    gtk_widget_set_hexpand(container_entry, TRUE);
    
    /* Banco de Dados */
    field.combo_db = gtk_combo_box_text_new ();
    gtk_widget_set_tooltip_text(field.combo_db, "Banco de Dados.");
    gtk_box_pack_start(GTK_BOX(container_entry), field.combo_db, FALSE, FALSE, 0);
    
    /* Code Builder or password SuperUser */
    field.entry_pwd=gtk_entry_new();
    gtk_widget_set_tooltip_text(field.entry_pwd, "Digite a senha de Super Usuario.");
    gtk_entry_set_visibility(GTK_ENTRY(field.entry_pwd), FALSE);
    gtk_entry_set_placeholder_text(GTK_ENTRY(field.entry_pwd), "Senha Mestre");
    gtk_box_pack_start(GTK_BOX(container_entry), field.entry_pwd, FALSE, FALSE, 0);
    
    /* Button Refresh */
    field.button = gtk_button_new_with_label("Deletar");
    gtk_box_pack_start(GTK_BOX(container_entry), field.button, FALSE, FALSE, 0);
    
    gtk_stack_add_named (GTK_STACK (stack), widget, "Deletar");
    gtk_container_child_set (GTK_CONTAINER (stack), widget, "title", "Deletar", NULL);
    
    //TODO Criar os sinais refresh e delete.
    
    g_signal_connect (GTK_BUTTON (button_refresh),
                    "clicked", 
                    G_CALLBACK (button_refresh_delete_clicked), 
                    (gpointer) &field);
}
static void
cc_bluetooth_panel_init (CcBluetoothPanel *self)
{
	GError *error = NULL;

	self->priv = BLUETOOTH_PANEL_PRIVATE (self);
	g_resources_register (cc_bluetooth_get_resource ());

	self->priv->builder = gtk_builder_new ();
	gtk_builder_set_translation_domain (self->priv->builder, GETTEXT_PACKAGE);
	gtk_builder_add_from_resource (self->priv->builder,
                                       "/org/gnome/control-center/bluetooth/bluetooth.ui",
                                       &error);
	if (error != NULL) {
		g_warning ("Could not load ui: %s", error->message);
		g_error_free (error);
		return;
	}

	self->priv->cancellable = g_cancellable_new ();

	/* RFKill */
	self->priv->rfkill = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
							    G_DBUS_PROXY_FLAGS_NONE,
							    NULL,
							    "org.gnome.SettingsDaemon.Rfkill",
							    "/org/gnome/SettingsDaemon/Rfkill",
							    "org.gnome.SettingsDaemon.Rfkill",
							    NULL, NULL);
	self->priv->properties = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
								G_DBUS_PROXY_FLAGS_NONE,
								NULL,
								"org.gnome.SettingsDaemon.Rfkill",
								"/org/gnome/SettingsDaemon/Rfkill",
								"org.freedesktop.DBus.Properties",
								NULL, NULL);

	self->priv->stack = gtk_stack_new ();
	gtk_stack_set_homogeneous (GTK_STACK (self->priv->stack), TRUE);
	add_stack_page (self, _("No Bluetooth Found"), _("Plug in a dongle to use Bluetooth."), BLUETOOTH_NO_DEVICES_PAGE);
	add_stack_page (self, _("Bluetooth Turned Off"), _("Turn on to connect devices and receive file transfers."), BLUETOOTH_DISABLED_PAGE);
	add_stack_page (self, _("Airplane Mode is on"), _("Bluetooth is disabled when airplane mode is on."), BLUETOOTH_AIRPLANE_PAGE);
	add_stack_page (self, _("Hardware Airplane Mode is on"), _("Turn off the Airplane mode switch to enable Bluetooth."), BLUETOOTH_HW_AIRPLANE_PAGE);

	self->priv->widget = bluetooth_settings_widget_new ();
	g_signal_connect (G_OBJECT (self->priv->widget), "panel-changed",
			  G_CALLBACK (panel_changed), self);
	gtk_stack_add_named (GTK_STACK (self->priv->stack),
			     self->priv->widget, BLUETOOTH_WORKING_PAGE);
	gtk_widget_show (self->priv->widget);
	gtk_widget_show (self->priv->stack);

	gtk_container_add (GTK_CONTAINER (self), self->priv->stack);

	airplane_mode_changed (NULL, NULL, NULL, self);
	g_signal_connect (self->priv->rfkill, "g-properties-changed",
			  G_CALLBACK (airplane_mode_changed), self);
	g_signal_connect_swapped (G_OBJECT (self->priv->widget), "adapter-status-changed",
				  G_CALLBACK (cc_bluetooth_panel_update_power), self);

	g_signal_connect (G_OBJECT (WID ("switch_bluetooth")), "notify::active",
			  G_CALLBACK (power_callback), self);
}
Ejemplo n.º 26
0
static void
gdaui_dsn_editor_init (GdauiDsnEditor *config, G_GNUC_UNUSED GdauiDsnEditorClass *klass)
{
	GtkWidget *grid;
	GtkWidget *label;
	GtkWidget *exp;
	gchar *str;

	g_return_if_fail (GDAUI_IS_DSN_EDITOR (config));

	gtk_orientable_set_orientation (GTK_ORIENTABLE (config), GTK_ORIENTATION_VERTICAL);

	/* allocate private structure */
	config->priv = g_new0 (GdauiDsnEditorPrivate, 1);
	config->priv->dsn_info = g_new0 (GdaDsnInfo, 1);
	config->priv->no_change_signal = TRUE;

	/* data source's name and icon */
	GtkWidget *hbox_header;
	hbox_header = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_box_pack_start (GTK_BOX (config), hbox_header, FALSE, FALSE, 6);
	config->priv->icon = gtk_image_new ();
	gtk_widget_set_size_request (config->priv->icon, -1, SUPPORT_ICON_SIZE);
	gtk_box_pack_start (GTK_BOX (hbox_header), config->priv->icon, FALSE, FALSE, 0);
	config->priv->wname = gtk_label_new ("");
	gtk_box_pack_start (GTK_BOX (hbox_header), config->priv->wname, FALSE, FALSE, 10);

	GtkWidget *menu_button;
	menu_button = gtk_menu_button_new ();
	gtk_box_pack_end (GTK_BOX (hbox_header), menu_button, FALSE, FALSE, 0);

	GtkWidget *menu_icon;
        menu_icon = gtk_image_new_from_icon_name ("open-menu-symbolic", GTK_ICON_SIZE_MENU);
        gtk_button_set_image (GTK_BUTTON (menu_button), menu_icon);

	GMenu *smenu;
        smenu = g_menu_new ();
        gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (menu_button), G_MENU_MODEL (smenu));

	GMenuItem *mitem;
        mitem = g_menu_item_new ("Test data source", "win.DSNTest");
        g_menu_insert_item (smenu, -1, mitem);
        mitem = g_menu_item_new ("Reset data source's changes", "win.DSNReset");
        g_menu_insert_item (smenu, -1, mitem);
        mitem = g_menu_item_new ("Duplicate data source", "win.DSNCopy");
        g_menu_insert_item (smenu, -1, mitem);

	GtkWindow *win;
	win = gtk_application_get_active_window (GTK_APPLICATION (g_application_get_default ()));
	g_action_map_add_action_entries (G_ACTION_MAP (win), win_entries, G_N_ELEMENTS (win_entries), config);

	/* stack in a scrolled window */
	GtkWidget *sw;
	sw = gtk_scrolled_window_new (NULL, NULL);
	gtk_widget_set_vexpand (sw, TRUE);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_NONE);
	gtk_box_pack_start (GTK_BOX (config), sw, TRUE, TRUE, 6);

	/* Stack */
	config->priv->stack = gtk_stack_new ();
	gtk_stack_set_transition_type (GTK_STACK (config->priv->stack), GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT);
	gtk_container_add (GTK_CONTAINER (sw), config->priv->stack);
	
	/* set up widgets */
	grid = gtk_grid_new ();
	gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
	gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
	gtk_widget_show (grid);

	label = gtk_label_new_with_mnemonic (_("_System wide data source:"));
	gtk_widget_set_halign (label, GTK_ALIGN_START);
	gtk_widget_set_hexpand (label, FALSE);
	g_object_set (G_OBJECT (label), "xalign", 0., NULL);
	gtk_widget_show (label);
	gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
	config->priv->is_system = gtk_check_button_new ();
	gtk_widget_show (config->priv->is_system);
	g_signal_connect (G_OBJECT (config->priv->is_system), "toggled",
			  G_CALLBACK (field_toggled_cb), config);
	gtk_grid_attach (GTK_GRID (grid), config->priv->is_system, 1, 1, 1, 1);

	str = g_strdup_printf ("%s <span foreground='red' weight='bold'>*</span>", _("_Provider:"));
	label = gtk_label_new ("");
	gtk_label_set_markup_with_mnemonic (GTK_LABEL (label), str);
	g_free (str);
	gtk_widget_set_halign (label, GTK_ALIGN_START);
	gtk_widget_set_hexpand (label, FALSE);
	g_object_set (G_OBJECT (label), "xalign", 0., NULL);
	gtk_widget_show (label);
	gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
	config->priv->wprovider = gdaui_provider_selector_new ();
	gtk_widget_set_hexpand (config->priv->wprovider, TRUE);
	gtk_label_set_mnemonic_widget (GTK_LABEL (label), config->priv->wprovider);
	gtk_widget_show (config->priv->wprovider);
	g_signal_connect (G_OBJECT (config->priv->wprovider), "changed",
			  G_CALLBACK (field_changed_cb), config);
	gtk_grid_attach (GTK_GRID (grid), config->priv->wprovider, 1, 2, 1, 1);

	label = gtk_label_new_with_mnemonic (_("_Description:"));
	gtk_widget_set_halign (label, GTK_ALIGN_START);
	gtk_widget_set_hexpand (label, FALSE);
	g_object_set (G_OBJECT (label), "xalign", 0., NULL);
	gtk_widget_show (label);
	gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);

	sw = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_ETCHED_IN);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
	config->priv->wdesc = gtk_text_view_new ();
	gtk_container_add (GTK_CONTAINER (sw), config->priv->wdesc);
	gtk_text_view_set_editable (GTK_TEXT_VIEW (config->priv->wdesc), TRUE);
	gtk_widget_set_vexpand (config->priv->wdesc, TRUE);
	gtk_label_set_mnemonic_widget (GTK_LABEL (label), config->priv->wdesc);
	g_signal_connect (gtk_text_view_get_buffer (GTK_TEXT_VIEW (config->priv->wdesc)), "changed",
			  G_CALLBACK (field_changed_cb), config);
	gtk_grid_attach (GTK_GRID (grid), sw, 1, 3, 1, 1);

	config->priv->warning = gtk_label_new (NULL);
	gtk_label_set_markup (GTK_LABEL (config->priv->warning),
			      _("<span foreground='red'>The database provider used by this data source is not available,\n"
				"editing the data source's attributes is disabled</span>"));
	gtk_widget_set_halign (config->priv->warning, GTK_ALIGN_CENTER);
	gtk_widget_set_hexpand (config->priv->warning, TRUE);
	g_object_set (G_OBJECT (config->priv->warning), "xalign", 0.5, NULL);
	gtk_label_set_justify (GTK_LABEL (config->priv->warning), GTK_JUSTIFY_CENTER);
	gtk_label_set_line_wrap (GTK_LABEL (config->priv->warning), TRUE);
	gtk_grid_attach (GTK_GRID (grid), config->priv->warning, 0, 8, 2, 1);
	gtk_stack_add_named (GTK_STACK (config->priv->stack), grid, PANE_DEFINITION);

	/* connection's spec */
	config->priv->dsn_spec = _gdaui_provider_spec_editor_new (gdaui_provider_selector_get_provider 
								 (GDAUI_PROVIDER_SELECTOR (config->priv->wprovider)));
	g_signal_connect (G_OBJECT (config->priv->dsn_spec), "changed",
			  G_CALLBACK (field_changed_cb), config);
	gtk_widget_show (config->priv->dsn_spec);
	gtk_stack_add_named (GTK_STACK (config->priv->stack), config->priv->dsn_spec, PANE_PARAMS);

	/* connection's authentication */
	config->priv->dsn_auth = _gdaui_provider_auth_editor_new (gdaui_provider_selector_get_provider 
								 (GDAUI_PROVIDER_SELECTOR (config->priv->wprovider)));
	g_signal_connect (G_OBJECT (config->priv->dsn_auth), "changed",
			  G_CALLBACK (field_changed_cb), config);
	gtk_widget_show (config->priv->dsn_auth);
	gtk_stack_add_named (GTK_STACK (config->priv->stack), config->priv->dsn_auth, PANE_AUTH);

	config->priv->no_change_signal = FALSE;
}
Ejemplo n.º 27
0
static void
ring_main_window_init(RingMainWindow *win)
{
    RingMainWindowPrivate *priv = RING_MAIN_WINDOW_GET_PRIVATE(win);
    gtk_widget_init_template(GTK_WIDGET(win));

     /* set window icon */
    GError *error = NULL;
    GdkPixbuf* icon = gdk_pixbuf_new_from_resource("/cx/ring/RingGnome/ring-symbol-blue", &error);
    if (icon == NULL) {
        g_debug("Could not load icon: %s", error->message);
        g_clear_error(&error);
    } else
        gtk_window_set_icon(GTK_WINDOW(win), icon);

    /* set menu icon */
    GdkPixbuf* image_ring = gdk_pixbuf_new_from_resource_at_scale("/cx/ring/RingGnome/ring-symbol-blue",
                                                                  -1, 24, TRUE, &error);
    if (image_ring == NULL) {
        g_debug("Could not load icon: %s", error->message);
        g_clear_error(&error);
    } else
        gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image_ring), image_ring);

    /* ring menu */
    GtkBuilder *builder = gtk_builder_new_from_resource("/cx/ring/RingGnome/ringgearsmenu.ui");
    GMenuModel *menu = G_MENU_MODEL(gtk_builder_get_object(builder, "menu"));
    gtk_menu_button_set_menu_model(GTK_MENU_BUTTON(priv->ring_menu), menu);
    g_object_unref(builder);

    /* settings icon */
    gtk_image_set_from_icon_name(GTK_IMAGE(priv->image_settings), "emblem-system-symbolic", GTK_ICON_SIZE_LARGE_TOOLBAR);

    /* connect settings button signal */
    g_signal_connect(priv->ring_settings, "clicked", G_CALLBACK(settings_clicked), win);

    /* add the call view to the main stack */
    gtk_stack_add_named(GTK_STACK(priv->stack_main_view),
                        priv->vbox_call_view,
                        CALL_VIEW_NAME);

    if (has_ring_account()) {
        /* user has ring account, so show the call view right away */
        gtk_stack_set_visible_child(GTK_STACK(priv->stack_main_view), priv->vbox_call_view);
    } else {
        /* user has to create the ring account */
        show_account_creation(win);
    }

    /* init the settings views */
    priv->account_settings_view = account_view_new();
    gtk_stack_add_named(GTK_STACK(priv->stack_main_view), priv->account_settings_view, ACCOUNT_SETTINGS_VIEW_NAME);

    priv->media_settings_view = media_settings_view_new();
    gtk_stack_add_named(GTK_STACK(priv->stack_main_view), priv->media_settings_view, MEDIA_SETTINGS_VIEW_NAME);

    priv->general_settings_view = general_settings_view_new();
    gtk_stack_add_named(GTK_STACK(priv->stack_main_view), priv->general_settings_view, GENERAL_SETTINGS_VIEW_NAME);

    /* make the setting we will show first the active one */
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->radiobutton_general_settings), TRUE);
    priv->last_settings_view = priv->general_settings_view;

    /* connect the settings button signals to switch settings views */
    g_signal_connect(priv->radiobutton_media_settings, "toggled", G_CALLBACK(show_media_settings), win);
    g_signal_connect(priv->radiobutton_account_settings, "toggled", G_CALLBACK(show_account_settings), win);
    g_signal_connect(priv->radiobutton_general_settings, "toggled", G_CALLBACK(show_general_settings), win);

    /* populate the notebook */
    auto smart_view = recent_contacts_view_new();
    gtk_container_add(GTK_CONTAINER(priv->scrolled_window_smartview), smart_view);

    auto contacts_view = contacts_view_new();
    gtk_container_add(GTK_CONTAINER(priv->scrolled_window_contacts), contacts_view);

    auto history_view = history_view_new();
    gtk_container_add(GTK_CONTAINER(priv->scrolled_window_history), history_view);

    /* welcome/default view */
    priv->welcome_view = ring_welcome_view_new();
    g_object_ref(priv->welcome_view);
    // gtk_stack_add_named(GTK_STACK(priv->stack_call_view), welcome_view, DEFAULT_VIEW_NAME);
    gtk_container_add(GTK_CONTAINER(priv->frame_call), priv->welcome_view);
    gtk_widget_show(priv->welcome_view);

    /* call/chat selection */
    QObject::connect(
       RecentModel::instance().selectionModel(),
       &QItemSelectionModel::currentChanged,
       [win](const QModelIndex current, G_GNUC_UNUSED const QModelIndex & previous) {
            if (auto call = RecentModel::instance().getActiveCall(current)) {
                /* if the call is on hold, we want to put it off hold automatically
                 * when switching to it */
                if (call->state() == Call::State::HOLD)
                    call << Call::Action::HOLD;
            }
            selection_changed(current, win);
        }
    );

    /* connect to dataChanged of the RecentModel to see if we need to change the view */
    QObject::connect(
        &RecentModel::instance(),
        &RecentModel::dataChanged,
        [win](const QModelIndex & topLeft, G_GNUC_UNUSED const QModelIndex & bottomRight, G_GNUC_UNUSED const QVector<int> & roles) {
            /* it is possible for dataChanged to be emitted inside of a dataChanged handler or
             * some other signal; since the connection is via a lambda, Qt would cause the
             * handler to be called directly. This is not behaviour we usually want, so we call our
             * function via g_idle so that it gets called after the initial handler is done.
             */
            if (topLeft == RecentModel::instance().selectionModel()->currentIndex())
                g_idle_add((GSourceFunc)selected_item_changed, win);
        }
    );

    g_signal_connect(priv->button_placecall, "clicked", G_CALLBACK(search_entry_placecall), win);
    g_signal_connect(priv->search_entry, "activate", G_CALLBACK(search_entry_placecall), win);

    /* autocompletion */
    priv->q_completion_model = new NumberCompletionModel();

    /* autocompletion renderers */
    GtkCellArea *completion_area = gtk_cell_area_box_new();

    /* photo renderer */
    GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();
    gtk_cell_area_box_pack_start(GTK_CELL_AREA_BOX(completion_area),
                                 renderer,
                                 TRUE,  /* expand */
                                 TRUE,  /* align */
                                 TRUE); /* fixed size */

    gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(completion_area),
                                       renderer,
                                       (GtkCellLayoutDataFunc)autocompletion_photo_render,
                                       NULL, NULL);

    /* name renderer */
    renderer = gtk_cell_renderer_text_new();
    g_object_set(G_OBJECT(renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
    gtk_cell_area_box_pack_start(GTK_CELL_AREA_BOX(completion_area),
                                 renderer,
                                 TRUE,  /* expand */
                                 TRUE,  /* align */
                                 TRUE); /* fixed size */

    gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(completion_area),
                                       renderer,
                                       (GtkCellLayoutDataFunc)autocompletion_name_render,
                                       NULL, NULL);

    /* number renderer */
    renderer = gtk_cell_renderer_text_new();
    g_object_set(G_OBJECT(renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
    gtk_cell_area_box_pack_start(GTK_CELL_AREA_BOX(completion_area),
                                 renderer,
                                 TRUE,  /* expand */
                                 TRUE,  /* align */
                                 TRUE); /* fixed size */

    gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(completion_area),
                                       renderer,
                                       (GtkCellLayoutDataFunc)autocompletion_number_render,
                                       NULL, NULL);
    /* account renderer */
    renderer = gtk_cell_renderer_text_new();
    g_object_set(G_OBJECT(renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
    gtk_cell_area_box_pack_start(GTK_CELL_AREA_BOX(completion_area),
                                 renderer,
                                 TRUE,  /* expand */
                                 TRUE,  /* align */
                                 TRUE); /* fixed size */

    gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(completion_area),
                                       renderer,
                                       (GtkCellLayoutDataFunc)autocompletion_account_render,
                                       NULL, NULL);

    GtkEntryCompletion *entry_completion = gtk_entry_completion_new_with_area(completion_area);

    GtkQTreeModel *completion_model = gtk_q_tree_model_new(
        (QAbstractItemModel *)priv->q_completion_model,
        1,
        Qt::DisplayRole, G_TYPE_STRING);

    gtk_entry_completion_set_model(entry_completion, GTK_TREE_MODEL(completion_model));

    gtk_entry_set_completion(GTK_ENTRY(priv->search_entry), entry_completion);
    gtk_entry_completion_set_match_func(
        entry_completion,
        (GtkEntryCompletionMatchFunc) completion_match_func,
        NULL,
        NULL);

    /* connect signal to when text is entered in the entry */
    g_signal_connect(priv->search_entry, "changed", G_CALLBACK(search_entry_text_changed), win);
    g_signal_connect(entry_completion, "match-selected", G_CALLBACK(select_autocompletion), win);

    /* connect to incoming call and focus */
    QObject::connect(
        &CallModel::instance(),
        &CallModel::incomingCall,
        [=](Call* call) {
            CallModel::instance().selectionModel()->setCurrentIndex(
                CallModel::instance().getIndex(call), QItemSelectionModel::ClearAndSelect);
        }
    );

    /* react to digit key press events */
    g_signal_connect(win, "key-press-event", G_CALLBACK(dtmf_pressed), NULL);

    /* set the search entry placeholder text */
    gtk_entry_set_placeholder_text(GTK_ENTRY(priv->search_entry),
                                   C_("Please try to make the translation 50 chars or less so that it fits into the layout", "Search contacts or enter number"));
}
Ejemplo n.º 28
0
static void
nemo_toolbar_constructed (GObject *obj)
{
	NemoToolbar *self = NEMO_TOOLBAR (obj);
	GtkWidget *toolbar;
    GtkWidget *hbox;
    GtkToolItem *tool_box;
    GtkWidget *box;
	GtkStyleContext *context;

	G_OBJECT_CLASS (nemo_toolbar_parent_class)->constructed (obj);

	gtk_style_context_set_junction_sides (gtk_widget_get_style_context (GTK_WIDGET (self)),
					      GTK_JUNCTION_BOTTOM);

    self->priv->show_location_entry = g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_SHOW_LOCATION_ENTRY);

	/* add the UI */
	self->priv->ui_manager = gtk_ui_manager_new ();
	gtk_ui_manager_insert_action_group (self->priv->ui_manager, self->priv->action_group, 0);

	toolbar = gtk_toolbar_new ();
	self->priv->toolbar = toolbar;
    gtk_box_pack_start (GTK_BOX (self), self->priv->toolbar, TRUE, TRUE, 0);
	
	context = gtk_widget_get_style_context (GTK_WIDGET(toolbar));
	gtk_style_context_add_class (context, GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
	
    /* Back/Forward/Up */
    self->priv->navigation_box = gtk_tool_item_new ();
    box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

    self->priv->previous_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_BACK);
    gtk_container_add (GTK_CONTAINER (box), self->priv->previous_button);

    self->priv->next_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_FORWARD);
    gtk_container_add (GTK_CONTAINER (box), self->priv->next_button);

    self->priv->up_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_UP);
    gtk_container_add (GTK_CONTAINER (box), self->priv->up_button);

    gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED);
    gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LINKED);

    gtk_container_add (GTK_CONTAINER (self->priv->navigation_box), GTK_WIDGET (box));
    gtk_container_add (GTK_CONTAINER (self->priv->toolbar), GTK_WIDGET (self->priv->navigation_box));

    gtk_widget_show_all (GTK_WIDGET (self->priv->navigation_box));
    gtk_widget_set_margin_right (GTK_WIDGET (self->priv->navigation_box), 6);

    /* Refresh */
    self->priv->refresh_box = gtk_tool_item_new ();
    box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

    self->priv->refresh_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_RELOAD);
    gtk_container_add (GTK_CONTAINER (box), self->priv->refresh_button);
    gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED);

    gtk_container_add (GTK_CONTAINER (self->priv->refresh_box), GTK_WIDGET (box));
    gtk_container_add (GTK_CONTAINER (self->priv->toolbar), GTK_WIDGET (self->priv->refresh_box));

    gtk_widget_show_all (GTK_WIDGET (self->priv->refresh_box));
    gtk_widget_set_margin_right (GTK_WIDGET (self->priv->refresh_box), 6);

    /* Home/Computer */
    self->priv->location_box = gtk_tool_item_new ();
    box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

    self->priv->home_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_HOME);
    gtk_container_add (GTK_CONTAINER (box), self->priv->home_button);

    self->priv->computer_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_COMPUTER);
    gtk_container_add (GTK_CONTAINER (box), self->priv->computer_button);

    gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED);
    gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LINKED);

    gtk_container_add (GTK_CONTAINER (self->priv->location_box), GTK_WIDGET (box));
    gtk_container_add (GTK_CONTAINER (self->priv->toolbar), GTK_WIDGET (self->priv->location_box));

    gtk_widget_show_all (GTK_WIDGET (self->priv->location_box));
    gtk_widget_set_margin_right (GTK_WIDGET (self->priv->location_box), 6);

    /* Container to hold the location and pathbars */
    self->priv->stack = gtk_stack_new();
    gtk_stack_set_transition_type (GTK_STACK (self->priv->stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE);
    gtk_stack_set_transition_duration (GTK_STACK (self->priv->stack), 150);

    /* Regular Path Bar */
    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (self->priv->stack), TRUE, TRUE, 0);

    self->priv->path_bar = g_object_new (NEMO_TYPE_PATH_BAR, NULL);
    gtk_stack_add_named(GTK_STACK (self->priv->stack), GTK_WIDGET (self->priv->path_bar), "path_bar");
    
    /* Entry-Like Location Bar */
    self->priv->location_bar = nemo_location_bar_new ();
    gtk_stack_add_named(GTK_STACK (self->priv->stack), GTK_WIDGET (self->priv->location_bar), "location_bar");
    gtk_widget_show_all (hbox);

    tool_box = gtk_tool_item_new ();
    gtk_tool_item_set_expand (tool_box, TRUE);
    gtk_container_add (GTK_CONTAINER (tool_box), hbox);
    gtk_container_add (GTK_CONTAINER (self->priv->toolbar), GTK_WIDGET (tool_box));
    gtk_widget_show (GTK_WIDGET (tool_box));

    /* Search/Open in Terminal/New Folder/Toggle Location */
    self->priv->tools_box = gtk_tool_item_new ();
    box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

    self->priv->toggle_location_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_TOGGLE_LOCATION);
    gtk_container_add (GTK_CONTAINER (box), self->priv->toggle_location_button);

    self->priv->open_terminal_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_OPEN_IN_TERMINAL);
    gtk_container_add (GTK_CONTAINER (box), self->priv->open_terminal_button);

    self->priv->new_folder_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_NEW_FOLDER);
    gtk_container_add (GTK_CONTAINER (box), self->priv->new_folder_button);

    self->priv->search_button = toolbar_create_toolbutton (self, TRUE, NEMO_ACTION_SEARCH);
    gtk_container_add (GTK_CONTAINER (box), self->priv->search_button);

    gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED);
    gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LINKED);

    gtk_container_add (GTK_CONTAINER (self->priv->tools_box), GTK_WIDGET (box));
    gtk_container_add (GTK_CONTAINER (self->priv->toolbar), GTK_WIDGET (self->priv->tools_box));

    gtk_widget_show_all (GTK_WIDGET (self->priv->tools_box));
    gtk_widget_set_margin_left (GTK_WIDGET (self->priv->tools_box), 6);

    setup_root_info_bar (self);

    /* View Select */
    self->priv->view_box = gtk_tool_item_new ();
    box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

    self->priv->icon_view_button = toolbar_create_toolbutton (self, TRUE, NEMO_ACTION_ICON_VIEW);
    gtk_container_add (GTK_CONTAINER (box), self->priv->icon_view_button);

    self->priv->list_view_button = toolbar_create_toolbutton (self, TRUE, NEMO_ACTION_LIST_VIEW);
    gtk_container_add (GTK_CONTAINER (box), self->priv->list_view_button);

    self->priv->compact_view_button = toolbar_create_toolbutton (self, TRUE, NEMO_ACTION_COMPACT_VIEW);
    gtk_container_add (GTK_CONTAINER (box), self->priv->compact_view_button);

    gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED);
    gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LINKED);

    gtk_container_add (GTK_CONTAINER (self->priv->view_box), GTK_WIDGET (box));
    gtk_container_add (GTK_CONTAINER (self->priv->toolbar), GTK_WIDGET (self->priv->view_box));

    gtk_widget_show_all (GTK_WIDGET (self->priv->view_box));
    gtk_widget_set_margin_left (GTK_WIDGET (self->priv->view_box), 6);

    /* nemo patch */
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_PREVIOUS_ICON_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_NEXT_ICON_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_UP_ICON_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_EDIT_ICON_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_RELOAD_ICON_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_HOME_ICON_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_COMPUTER_ICON_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_SEARCH_ICON_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_NEW_FOLDER_ICON_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_OPEN_IN_TERMINAL_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_ICON_VIEW_ICON_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_LIST_VIEW_ICON_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);
    g_signal_connect_swapped (nemo_preferences,
                  "changed::" NEMO_PREFERENCES_SHOW_COMPACT_VIEW_ICON_TOOLBAR,
                  G_CALLBACK (toolbar_update_appearance), self);

	toolbar_update_appearance (self);
}
Ejemplo n.º 29
0
void gui_init(dt_lib_module_t *self)
{
  self->data = calloc(1, sizeof(dt_lib_live_view_t));

  // Setup lib data
  dt_lib_live_view_t *lib = self->data;
  lib->splitline_x = lib->splitline_y = 0.5;

  // Setup gui
  self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
  dt_gui_add_help_link(self->widget, "live_view.html#live_view");
  GtkWidget *box;

  box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
  gtk_box_pack_start(GTK_BOX(self->widget), box, TRUE, TRUE, 0);
  lib->live_view = dtgtk_togglebutton_new(dtgtk_cairo_paint_eye, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
  lib->live_view_zoom = dtgtk_button_new(
      dtgtk_cairo_paint_zoom, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL); // TODO: see _zoom_live_view_clicked
  lib->rotate_ccw = dtgtk_button_new(dtgtk_cairo_paint_refresh, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
  lib->rotate_cw = dtgtk_button_new(dtgtk_cairo_paint_refresh,
                                    CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | CPF_DIRECTION_UP, NULL);
  lib->flip = dtgtk_togglebutton_new(dtgtk_cairo_paint_flip,
                                     CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | CPF_DIRECTION_UP, NULL);

  gtk_box_pack_start(GTK_BOX(box), lib->live_view, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(box), lib->live_view_zoom, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(box), lib->rotate_ccw, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(box), lib->rotate_cw, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(box), lib->flip, TRUE, TRUE, 0);

  gtk_widget_set_tooltip_text(lib->live_view, _("toggle live view"));
  gtk_widget_set_tooltip_text(lib->live_view_zoom, _("zoom live view"));
  gtk_widget_set_tooltip_text(lib->rotate_ccw, _("rotate 90 degrees ccw"));
  gtk_widget_set_tooltip_text(lib->rotate_cw, _("rotate 90 degrees cw"));
  gtk_widget_set_tooltip_text(lib->flip, _("flip live view horizontally"));

  g_signal_connect(G_OBJECT(lib->live_view), "clicked", G_CALLBACK(_toggle_live_view_clicked), lib);
  g_signal_connect(G_OBJECT(lib->live_view_zoom), "clicked", G_CALLBACK(_zoom_live_view_clicked), lib);
  g_signal_connect(G_OBJECT(lib->rotate_ccw), "clicked", G_CALLBACK(_rotate_ccw), lib);
  g_signal_connect(G_OBJECT(lib->rotate_cw), "clicked", G_CALLBACK(_rotate_cw), lib);
  g_signal_connect(G_OBJECT(lib->flip), "clicked", G_CALLBACK(_toggle_flip_clicked), lib);

  // focus buttons
  box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
  gtk_box_pack_start(GTK_BOX(self->widget), box, TRUE, TRUE, 0);
  lib->focus_in_big = dtgtk_button_new(dtgtk_cairo_paint_solid_triangle,
                                       CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | CPF_DIRECTION_LEFT, NULL);
  lib->focus_in_small
      = dtgtk_button_new(dtgtk_cairo_paint_arrow, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER
                                                  | CPF_DIRECTION_LEFT, NULL); // TODO icon not centered
  lib->focus_out_small = dtgtk_button_new(dtgtk_cairo_paint_arrow, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER
                                                                   | CPF_DIRECTION_RIGHT, NULL); // TODO same here
  lib->focus_out_big = dtgtk_button_new(dtgtk_cairo_paint_solid_triangle,
                                        CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | CPF_DIRECTION_RIGHT, NULL);

  gtk_box_pack_start(GTK_BOX(box), lib->focus_in_big, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(box), lib->focus_in_small, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(box), lib->focus_out_small, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(box), lib->focus_out_big, TRUE, TRUE, 0);

  gtk_widget_set_tooltip_text(lib->focus_in_big, _("move focus point in (big steps)"));
  gtk_widget_set_tooltip_text(lib->focus_in_small, _("move focus point in (small steps)"));
  gtk_widget_set_tooltip_text(lib->focus_out_small, _("move focus point out (small steps)"));
  gtk_widget_set_tooltip_text(lib->focus_out_big, _("move focus point out (big steps)"));

  // Near 3
  g_signal_connect(G_OBJECT(lib->focus_in_big), "clicked", G_CALLBACK(_focus_button_clicked),
                   GINT_TO_POINTER(2));
  // Near 1
  g_signal_connect(G_OBJECT(lib->focus_in_small), "clicked", G_CALLBACK(_focus_button_clicked),
                   GINT_TO_POINTER(0));
  // Far 1
  g_signal_connect(G_OBJECT(lib->focus_out_small), "clicked", G_CALLBACK(_focus_button_clicked),
                   GINT_TO_POINTER(4));
  // Far 3
  g_signal_connect(G_OBJECT(lib->focus_out_big), "clicked", G_CALLBACK(_focus_button_clicked),
                   GINT_TO_POINTER(6));

  // Guides
  lib->guide_selector = dt_bauhaus_combobox_new(NULL);
  dt_bauhaus_widget_set_label(lib->guide_selector, NULL, _("guides"));
  gtk_box_pack_start(GTK_BOX(self->widget), lib->guide_selector, TRUE, TRUE, 0);

  lib->guides_widgets = gtk_stack_new();
  gtk_stack_set_homogeneous(GTK_STACK(lib->guides_widgets), FALSE);
  gtk_box_pack_start(GTK_BOX(self->widget), lib->guides_widgets, TRUE, TRUE, 0);

  dt_bauhaus_combobox_add(lib->guide_selector, _("none"));
  int i = 0;
  for(GList *iter = darktable.guides; iter; iter = g_list_next(iter), i++)
  {
    GtkWidget *widget = NULL;
    dt_guides_t *guide = (dt_guides_t *)iter->data;
    dt_bauhaus_combobox_add(lib->guide_selector, _(guide->name));
    if(guide->widget)
    {
      // generate some unique name so that we can have the same name several times
      char name[5];
      snprintf(name, sizeof(name), "%d", i);
      widget = guide->widget(NULL, guide->user_data);
      gtk_widget_show_all(widget);
      gtk_stack_add_named(GTK_STACK(lib->guides_widgets), widget, name);
    }
    lib->guides_widgets_list = g_list_append(lib->guides_widgets_list, widget);
  }
  gtk_widget_set_no_show_all(lib->guides_widgets, TRUE);

  gtk_widget_set_tooltip_text(lib->guide_selector, _("display guide lines to help compose your photograph"));
  g_signal_connect(G_OBJECT(lib->guide_selector), "value-changed", G_CALLBACK(guides_presets_changed), lib);

  lib->flip_guides = dt_bauhaus_combobox_new(NULL);
  dt_bauhaus_widget_set_label(lib->flip_guides, NULL, _("flip"));
  dt_bauhaus_combobox_add(lib->flip_guides, _("none"));
  dt_bauhaus_combobox_add(lib->flip_guides, _("horizontally"));
  dt_bauhaus_combobox_add(lib->flip_guides, _("vertically"));
  dt_bauhaus_combobox_add(lib->flip_guides, _("both"));
  gtk_widget_set_tooltip_text(lib->flip_guides, _("flip guides"));
  gtk_box_pack_start(GTK_BOX(self->widget), lib->flip_guides, TRUE, TRUE, 0);

  lib->overlay = dt_bauhaus_combobox_new(NULL);
  dt_bauhaus_widget_set_label(lib->overlay, NULL, _("overlay"));
  dt_bauhaus_combobox_add(lib->overlay, _("none"));
  dt_bauhaus_combobox_add(lib->overlay, _("selected image"));
  dt_bauhaus_combobox_add(lib->overlay, _("id"));
  gtk_widget_set_tooltip_text(lib->overlay, _("overlay another image over the live view"));
  g_signal_connect(G_OBJECT(lib->overlay), "value-changed", G_CALLBACK(overlay_changed), lib);
  gtk_box_pack_start(GTK_BOX(self->widget), lib->overlay, TRUE, TRUE, 0);

  lib->overlay_id_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
  GtkWidget *label = gtk_label_new(_("image id"));
  gtk_widget_set_halign(label, GTK_ALIGN_START);
  lib->overlay_id = gtk_spin_button_new_with_range(0, 1000000000, 1);
  gtk_spin_button_set_digits(GTK_SPIN_BUTTON(lib->overlay_id), 0);
  gtk_widget_set_tooltip_text(lib->overlay_id, _("enter image id of the overlay manually"));
  g_signal_connect(G_OBJECT(lib->overlay_id), "value-changed", G_CALLBACK(_overlay_id_changed), lib);
  gtk_spin_button_set_value(GTK_SPIN_BUTTON(lib->overlay_id),
                            dt_conf_get_int("plugins/lighttable/live_view/overlay_imgid"));
  gtk_box_pack_start(GTK_BOX(lib->overlay_id_box), label, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(lib->overlay_id_box), lib->overlay_id, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(self->widget), lib->overlay_id_box, TRUE, TRUE, 0);
  gtk_widget_show(lib->overlay_id);
  gtk_widget_show(label);

  lib->overlay_mode = dt_bauhaus_combobox_new(NULL);
  dt_bauhaus_widget_set_label(lib->overlay_mode, NULL, _("overlay mode"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "normal"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "xor"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "add"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "saturate"));
#if(CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0))
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "multiply"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "screen"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "overlay"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "darken"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "lighten"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "color dodge"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "color burn"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "hard light"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "soft light"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "difference"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "exclusion"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "HSL hue"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "HSL saturation"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "HSL color"));
  dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "HSL luminosity"));
#endif
  gtk_widget_set_tooltip_text(lib->overlay_mode, _("mode of the overlay"));
  dt_bauhaus_combobox_set(lib->overlay_mode, dt_conf_get_int("plugins/lighttable/live_view/overlay_mode"));
  g_signal_connect(G_OBJECT(lib->overlay_mode), "value-changed", G_CALLBACK(_overlay_mode_changed), lib);
  gtk_box_pack_start(GTK_BOX(self->widget), lib->overlay_mode, TRUE, TRUE, 0);

  lib->overlay_splitline = dt_bauhaus_combobox_new(NULL);
  dt_bauhaus_widget_set_label(lib->overlay_splitline, NULL, _("split line"));
  dt_bauhaus_combobox_add(lib->overlay_splitline, _("off"));
  dt_bauhaus_combobox_add(lib->overlay_splitline, _("on"));
  gtk_widget_set_tooltip_text(lib->overlay_splitline, _("only draw part of the overlay"));
  dt_bauhaus_combobox_set(lib->overlay_splitline, dt_conf_get_int("plugins/lighttable/live_view/splitline"));
  g_signal_connect(G_OBJECT(lib->overlay_splitline), "value-changed", G_CALLBACK(_overlay_splitline_changed),
                   lib);
  gtk_box_pack_start(GTK_BOX(self->widget), lib->overlay_splitline, TRUE, TRUE, 0);

  gtk_widget_set_visible(GTK_WIDGET(lib->overlay_mode), FALSE);
  gtk_widget_set_visible(GTK_WIDGET(lib->overlay_id_box), FALSE);
  gtk_widget_set_visible(GTK_WIDGET(lib->overlay_splitline), FALSE);

  gtk_widget_set_no_show_all(GTK_WIDGET(lib->overlay_mode), TRUE);
  gtk_widget_set_no_show_all(GTK_WIDGET(lib->overlay_id_box), TRUE);
  gtk_widget_set_no_show_all(GTK_WIDGET(lib->overlay_splitline), TRUE);

  guides_presets_set_visibility(lib, 0);
}