static GtkWidget *
cc_sharing_panel_new_media_sharing_row (const char     *uri_or_path,
                                        CcSharingPanel *self)
{
  GtkWidget *row, *box, *w;
  GUserDirectory dir = G_USER_N_DIRECTORIES;
  GIcon *icon;
  guint i;
  char *basename, *path;
  GFile *file;

  file = g_file_new_for_commandline_arg (uri_or_path);
  path = g_file_get_path (file);
  g_object_unref (file);

  row = gtk_list_box_row_new ();
  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
  gtk_container_set_border_width (GTK_CONTAINER (box), 12);
  gtk_container_add (GTK_CONTAINER (row), box);

  /* Find the icon and create it */
  for (i = 0; i < G_USER_N_DIRECTORIES; i++)
    {
      if (g_strcmp0 (path, g_get_user_special_dir (i)) == 0)
        {
          dir = i;
          break;
        }
    }

  icon = special_directory_get_gicon (dir);
  w = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
  gtk_widget_set_margin_end (w, 12);
  gtk_container_add (GTK_CONTAINER (box), w);
  g_object_unref (icon);

  /* Label */
  basename = g_filename_display_basename (path);
  w = gtk_label_new (basename);
  g_free (basename);
  gtk_container_add (GTK_CONTAINER (box), w);

  /* Remove button */
  w = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR);
  gtk_button_set_relief (GTK_BUTTON (w), GTK_RELIEF_NONE);
  gtk_widget_set_margin_top (w, 3);
  gtk_widget_set_margin_bottom (w, 3);
  gtk_widget_set_margin_end (w, 12);
  gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
  gtk_box_pack_end (GTK_BOX (box), w, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (w), "clicked",
                    G_CALLBACK (cc_sharing_panel_remove_folder), self);
  g_object_set_data (G_OBJECT (w), "row", row);

  g_object_set_data_full (G_OBJECT (row), "path", g_strdup (path), g_free);

  gtk_widget_show_all (row);

  return row;
}
static void
photos_edit_palette_row_constructed (GObject *object)
{
  PhotosEditPaletteRow *self = PHOTOS_EDIT_PALETTE_ROW (object);
  GtkWidget *grid0;
  GtkWidget *grid1;
  GtkWidget *image;
  GtkWidget *label;
  GtkWidget *tool_widget;
  const gchar *icon_name;
  const gchar *name;
  gchar *name_markup;

  G_OBJECT_CLASS (photos_edit_palette_row_parent_class)->constructed (object);

  self->row_revealer = gtk_revealer_new();
  gtk_revealer_set_transition_type (GTK_REVEALER (self->row_revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
  gtk_container_add (GTK_CONTAINER (self), self->row_revealer);

  grid0 = gtk_grid_new ();
  gtk_widget_set_margin_bottom (grid0, 6);
  gtk_widget_set_margin_start (grid0, 18);
  gtk_widget_set_margin_end (grid0, 18);
  gtk_widget_set_margin_top (grid0, 6);
  gtk_orientable_set_orientation (GTK_ORIENTABLE (grid0), GTK_ORIENTATION_VERTICAL);
  gtk_container_add (GTK_CONTAINER (self->row_revealer), grid0);

  grid1 = gtk_grid_new ();
  gtk_orientable_set_orientation (GTK_ORIENTABLE (grid1), GTK_ORIENTATION_HORIZONTAL);
  gtk_grid_set_column_spacing (GTK_GRID (grid1), 12);
  gtk_container_add (GTK_CONTAINER (grid0), grid1);

  icon_name = photos_tool_get_icon_name (self->tool);
  image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
  gtk_container_add (GTK_CONTAINER (grid1), image);

  name = photos_tool_get_name (self->tool);
  label = gtk_label_new (NULL);
  name_markup = g_strdup_printf ("<b>%s</b>", name);
  gtk_label_set_markup (GTK_LABEL (label), name_markup);
  gtk_container_add (GTK_CONTAINER (grid1), label);

  self->details_revealer = gtk_revealer_new ();
  gtk_revealer_set_transition_type (GTK_REVEALER (self->details_revealer),
                                    GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
  gtk_container_add (GTK_CONTAINER (grid0), self->details_revealer);

  tool_widget = photos_tool_get_widget (self->tool);
  gtk_widget_set_margin_bottom (tool_widget, 12);
  gtk_widget_set_margin_top (tool_widget, 12);
  gtk_container_add (GTK_CONTAINER (self->details_revealer), tool_widget);
  gtk_size_group_add_widget (self->size_group, tool_widget);

  g_signal_connect_swapped (self->tool, "hide-requested", G_CALLBACK (photos_edit_palette_row_hide_details), self);

  gtk_widget_show_all (GTK_WIDGET (self));

  g_free (name_markup);
  g_clear_object (&self->size_group); /* We will not need it any more */
}
Esempio n. 3
0
static GtkWidget *
handle_builder_error (const gchar *message, ...)
{
	GtkWidget *label;
	gchar *msg;
	gchar *msg_plain;
	va_list args;

	va_start (args, message);
	msg_plain = g_strdup_vprintf (message, args);
	va_end (args);

	label = gtk_label_new (NULL);
	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);

	msg = g_strconcat ("<span size=\"large\" weight=\"bold\">",
			   msg_plain, "</span>\n\n",
			   _("Please check your installation."),
			   NULL);

	gtk_label_set_markup (GTK_LABEL (label), msg);

	g_free (msg_plain);
	g_free (msg);

	gtk_widget_set_margin_start (label, 6);
	gtk_widget_set_margin_end (label, 6);
	gtk_widget_set_margin_top (label, 6);
	gtk_widget_set_margin_bottom (label, 6);

	return label;
}
Esempio n. 4
0
static GtkWidget *
action_editor (GObject                *object,
               GtkInspectorPropEditor *editor)
{
  GtkWidget *vbox;
  GtkWidget *label;
  GtkWidget *box;
  GtkWidget *button;
  GObject *owner;
  gchar *text;

  owner = find_action_owner (GTK_ACTIONABLE (object));

  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  if (owner)
    {
      label = gtk_label_new (_("Action"));
      gtk_widget_set_margin_top (label, 10);
      gtk_container_add (GTK_CONTAINER (vbox), label);
      box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
      text = g_strdup_printf (_("Defined at: %p (%s)"),
                              owner, g_type_name_from_instance ((GTypeInstance *)owner));
      gtk_container_add (GTK_CONTAINER (box), gtk_label_new (text));
      g_free (text);
      button = gtk_button_new_with_label (_("Properties"));
      g_object_set_data (G_OBJECT (button), "owner", owner);
      g_signal_connect (button, "clicked",
                        G_CALLBACK (show_action_owner), editor);
      gtk_container_add (GTK_CONTAINER (box), button);
      gtk_container_add (GTK_CONTAINER (vbox), box);
      gtk_widget_show_all (vbox);
    }

  return vbox;
}
Esempio n. 5
0
static void
ensure_size_window (MetaResizePopup *popup)
{
  GtkWidget *frame;

  if (popup->size_window)
    return;

  popup->size_window = gtk_window_new (GTK_WINDOW_POPUP);

  gtk_window_set_screen (GTK_WINDOW (popup->size_window),
			 gdk_display_get_default_screen (gdk_x11_lookup_xdisplay (popup->display)));

  /* never shrink the size window */
  gtk_window_set_resizable (GTK_WINDOW (popup->size_window),
                            TRUE);

  frame = gtk_frame_new (NULL);
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);

  gtk_container_add (GTK_CONTAINER (popup->size_window), frame);

  popup->size_label = gtk_label_new ("");
  gtk_widget_set_margin_start (popup->size_label, 3);
  gtk_widget_set_margin_end (popup->size_label, 3);
  gtk_widget_set_margin_top (popup->size_label, 3);
  gtk_widget_set_margin_bottom (popup->size_label, 3);

  gtk_container_add (GTK_CONTAINER (frame), popup->size_label);

  gtk_widget_show_all (frame);
}
static GtkWidget *
add_row (CcPrivacyPanel *self,
         const gchar    *label,
         const gchar    *dialog_id,
         GtkWidget      *status)
{
  GtkWidget *box, *row, *w;

  row = gtk_list_box_row_new ();
  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 50);
  gtk_container_add (GTK_CONTAINER (row), box);
  g_object_set_data (G_OBJECT (row), "dialog-id", (gpointer)dialog_id);
  gtk_widget_set_hexpand (box, TRUE);
  gtk_container_add (GTK_CONTAINER (self->priv->list_box), row);

  w = gtk_label_new (label);
  gtk_widget_set_halign (w, GTK_ALIGN_START);
  gtk_widget_set_margin_start (w, 20);
  gtk_widget_set_margin_end (w, 20);
  gtk_widget_set_margin_top (w, 12);
  gtk_widget_set_margin_bottom (w, 12);
  gtk_widget_set_halign (w, GTK_ALIGN_START);
  gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
  gtk_widget_set_hexpand (w, TRUE);
  gtk_box_pack_start (GTK_BOX (box), w, TRUE, TRUE, 0);
  gtk_widget_set_margin_start (status, 20);
  gtk_widget_set_margin_end (status, 20);
  gtk_widget_set_halign (status, GTK_ALIGN_END);
  gtk_widget_set_valign (status, GTK_ALIGN_CENTER);
  gtk_box_pack_end (GTK_BOX (box), status, FALSE, FALSE, 0);

  gtk_widget_show_all (row);

  return row;
}
Esempio n. 7
0
static void
update_title_header (GtkListBoxRow *row,
                     GtkListBoxRow *before,
                     gpointer       data)
{
  GtkWidget *header;
  gchar *title;

  header = gtk_list_box_row_get_header (row);
  title = (gchar *)g_object_get_data (G_OBJECT (row), "title");
  if (!header && title)
    {
      title = g_strdup_printf ("<b>%s</b>", title);

      header = gtk_label_new (title);
      gtk_label_set_use_markup (GTK_LABEL (header), TRUE);
      gtk_widget_set_halign (header, GTK_ALIGN_START);
      gtk_widget_set_margin_top (header, 12);
      gtk_widget_set_margin_start (header, 6);
      gtk_widget_set_margin_end (header, 6);
      gtk_widget_set_margin_bottom (header, 6);
      gtk_widget_show (header);

      gtk_list_box_row_set_header (row, header);

      g_free (title);
    }
}
static void
photos_print_notification_init (PhotosPrintNotification *self)
{
  PhotosPrintNotificationPrivate *priv;
  GtkWidget *image;

  self->priv = photos_print_notification_get_instance_private (self);
  priv = self->priv;

  priv->ntfctn_mngr = g_object_ref_sink (photos_notification_manager_dup_singleton ());

  priv->spinner = gtk_spinner_new ();
  gtk_widget_set_size_request (priv->spinner, 16, 16);
  gtk_container_add (GTK_CONTAINER (self), priv->spinner);

  priv->status_label = gtk_label_new (NULL);
  gtk_widget_set_halign (priv->status_label, GTK_ALIGN_START);
  gtk_container_add (GTK_CONTAINER (self), priv->status_label);

  image = gtk_image_new_from_icon_name (PHOTOS_ICON_PROCESS_STOP_SYMBOLIC, GTK_ICON_SIZE_INVALID);
  gtk_widget_set_margin_bottom (image, 2);
  gtk_widget_set_margin_top (image, 2);
  gtk_image_set_pixel_size (GTK_IMAGE (image), 16);

  priv->stop_button = gtk_button_new ();
  gtk_widget_set_valign (priv->stop_button, GTK_ALIGN_CENTER);
  gtk_button_set_image (GTK_BUTTON (priv->stop_button), image);
  gtk_container_add (GTK_CONTAINER (self), priv->stop_button);
  g_signal_connect_swapped (priv->stop_button,
                            "clicked",
                            G_CALLBACK (photos_print_notification_stop_clicked),
                            self);
}
Esempio n. 9
0
void style_set_margin(GtkWidget *widget, gint margin)
{
	style_set_margin_start(widget, margin);
	style_set_margin_end(widget, margin);
	gtk_widget_set_margin_top(widget, margin);
	gtk_widget_set_margin_bottom(widget, margin);
}
Esempio n. 10
0
static gboolean ask_and_delete(gpointer user_data)
{
  GList *empty_dirs = (GList *)user_data;
  const int n_empty_dirs = g_list_length(empty_dirs);

  GtkWidget *dialog;
  GtkWidget *win = dt_ui_main_window(darktable.gui->ui);

  dialog = gtk_message_dialog_new(GTK_WINDOW(win), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION,
                                  GTK_BUTTONS_YES_NO,
                                  ngettext("do you want to remove this empty directory?",
                                           "do you want to remove these empty directories?", n_empty_dirs));

  gtk_window_set_title(GTK_WINDOW(dialog),
                       ngettext("remove empty directory?", "remove empty directories?", n_empty_dirs));

  GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));

  GtkWidget *scroll = gtk_scrolled_window_new(NULL, NULL);
  gtk_widget_set_vexpand(scroll, TRUE);
  gtk_widget_set_margin_start(scroll, DT_PIXEL_APPLY_DPI(10));
  gtk_widget_set_margin_end(scroll, DT_PIXEL_APPLY_DPI(10));
  gtk_widget_set_margin_top(scroll, DT_PIXEL_APPLY_DPI(0));
  gtk_widget_set_margin_bottom(scroll, DT_PIXEL_APPLY_DPI(0));

  GtkListStore *store = gtk_list_store_new(1, G_TYPE_STRING);

  for(GList *list_iter = empty_dirs; list_iter; list_iter = g_list_next(list_iter))
  {
    GtkTreeIter iter;
    gtk_list_store_append(store, &iter);
    gtk_list_store_set(store, &iter, 0, list_iter->data, -1);
  }

  GtkWidget *tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
  gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE);

  GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes(_("name"), gtk_cell_renderer_text_new(),
                                                                       "text", 0, NULL);
  gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);

  gtk_container_add(GTK_CONTAINER(scroll), tree);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

  gtk_container_add(GTK_CONTAINER(content_area), scroll);

  gtk_widget_show_all(dialog); // needed for the content area!

  gint res = gtk_dialog_run(GTK_DIALOG(dialog));
  gtk_widget_destroy(dialog);
  if(res == GTK_RESPONSE_YES)
    for(GList *iter = empty_dirs; iter; iter = g_list_next(iter))
      rmdir((char *)iter->data);

  g_list_free_full(empty_dirs, g_free);
  g_object_unref(store);

  return FALSE;
}
static void
set_row_widget_margins (GtkWidget *widget)
{
  gtk_widget_set_margin_left (widget, 20);
  gtk_widget_set_margin_right (widget, 20);
  gtk_widget_set_margin_top (widget, 6);
  gtk_widget_set_margin_bottom (widget, 6);
}
Esempio n. 12
0
static void
gis_page_init (GisPage *page)
{
  gtk_widget_set_margin_start (GTK_WIDGET (page), 12);
  gtk_widget_set_margin_top (GTK_WIDGET (page), 12);
  gtk_widget_set_margin_bottom (GTK_WIDGET (page), 12);
  gtk_widget_set_margin_end (GTK_WIDGET (page), 12);
}
static void
set_row_widget_margins (GtkWidget *widget)
{
  gtk_widget_set_margin_start (widget, 20);
  gtk_widget_set_margin_end (widget, 20);
  gtk_widget_set_margin_top (widget, 6);
  gtk_widget_set_margin_bottom (widget, 6);
}
static void
show_account (GoaProvider         *provider,
              GoaClient           *client,
              GoaObject           *object,
              GtkBox              *vbox,
              G_GNUC_UNUSED GtkGrid *dummy1,
              G_GNUC_UNUSED GtkGrid *dummy2)
{
  EditData *data = NULL;
  GtkWidget *grid;
  GtkWidget *params_button = NULL;
  GtkWidget *details_button = NULL;
  GtkWidget *button_box = NULL;
  gint row = 0;

  goa_utils_account_add_attention_needed (client, object, provider, vbox);

  grid = gtk_grid_new ();
  gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
  gtk_widget_set_hexpand (grid, TRUE);
  gtk_widget_set_margin_end (grid, 72);
  gtk_widget_set_margin_start (grid, 72);
  gtk_widget_set_margin_top (grid, 24);
  gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
  gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
  gtk_container_add (GTK_CONTAINER (vbox), grid);

  goa_utils_account_add_header (object, GTK_GRID (grid), row++);

  goa_util_add_row_switch_from_keyfile_with_blurb (GTK_GRID (grid),
                                                   row++,
                                                   object,
                                                   /* Translators: This is a label for a series of
                                                    * options switches. For example: “Use for Mail”. */
                                                   _("Use for"),
                                                   "chat-disabled",
                                                   _("C_hat"));

  data = edit_data_new (object, tpaw_get_toplevel_window (GTK_WIDGET (vbox)));

  /* Connection Settings button */
  params_button = gtk_button_new_with_mnemonic (_("_Connection Settings"));
  edit_data_handle_button (data, params_button, G_CALLBACK (edit_parameters_clicked_cb));

  /* Edit Personal Information button */
  details_button = gtk_button_new_with_mnemonic (_("_Personal Details"));
  edit_data_handle_button (data, details_button, G_CALLBACK (edit_personal_details_clicked_cb));

  /* Box containing the buttons */
  button_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_box_pack_start (GTK_BOX (button_box), params_button,
      FALSE, FALSE, 12);
  gtk_container_add (GTK_CONTAINER (button_box), details_button);

  goa_util_add_row_widget (GTK_GRID (grid), row++, NULL, button_box);

  edit_data_unref (data);
}
static void gtk_technology_init(GtkTechnology *technology)
{
	GtkTechnologyPrivate *priv;

	priv =  G_TYPE_INSTANCE_GET_PRIVATE(technology,
						GTK_TYPE_TECHNOLOGY,
						GtkTechnologyPrivate);
	technology->priv = priv;

	priv->box = (GtkBox *) gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
	priv->enabler = (GtkSwitch *) gtk_switch_new();
	priv->name = (GtkLabel *) gtk_label_new(NULL);


	gtk_widget_set_margin_left((GtkWidget *)priv->enabler, 0);
	gtk_widget_set_margin_right((GtkWidget *)priv->enabler, 0);
	gtk_widget_set_margin_top((GtkWidget *)priv->enabler, 0);
	gtk_widget_set_margin_bottom((GtkWidget *)priv->enabler, 0);

	gtk_widget_set_margin_left((GtkWidget *)priv->name, 0);
	gtk_widget_set_margin_right((GtkWidget *)priv->name, 0);
	gtk_widget_set_margin_top((GtkWidget *)priv->name, 0);
	gtk_widget_set_margin_bottom((GtkWidget *)priv->name, 0);

	gtk_box_set_spacing(priv->box, 0);
	gtk_box_set_homogeneous(priv->box, TRUE);

	//gtk_widget_set_halign((GtkWidget *)priv->box, GTK_ALIGN_START);
	gtk_widget_set_halign((GtkWidget *)priv->name, GTK_ALIGN_START);
	//gtk_widget_set_halign((GtkWidget *)technology, GTK_ALIGN_START);

	gtk_box_pack_start(priv->box,
			(GtkWidget *)priv->enabler, FALSE, FALSE, 0);
	gtk_box_pack_start(priv->box,
			(GtkWidget *)priv->name, FALSE, FALSE, 0);

	gtk_widget_set_visible((GtkWidget *)priv->box, TRUE);
	gtk_widget_set_visible((GtkWidget *)priv->enabler, TRUE);
	gtk_widget_set_visible((GtkWidget *)priv->name, TRUE);

	gtk_container_add(GTK_CONTAINER(technology), (GtkWidget *)priv->box);

	gtk_widget_set_can_focus((GtkWidget *)priv->box, TRUE);
	gtk_widget_set_can_focus((GtkWidget *)priv->enabler, TRUE);
}
Esempio n. 16
0
static void
gtk_tooltip_init (GtkTooltip *tooltip)
{
  GtkStyleContext *context;
  GtkWidget *window;
  GtkWidget *box;
  GtkWidget *image;
  GtkWidget *label;

  tooltip->timeout_id = 0;
  tooltip->browse_mode_timeout_id = 0;

  tooltip->browse_mode_enabled = FALSE;
  tooltip->keyboard_mode_enabled = FALSE;

  tooltip->current_window = NULL;
  tooltip->keyboard_widget = NULL;

  tooltip->tooltip_widget = NULL;

  tooltip->last_window = NULL;

  window = gtk_window_new (GTK_WINDOW_POPUP);
  gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_TOOLTIP);
  gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
  gtk_window_set_use_subsurface (GTK_WINDOW (window), TRUE);
  g_signal_connect (window, "hide",
                    G_CALLBACK (gtk_tooltip_window_hide), tooltip);

  _gtk_window_request_csd (GTK_WINDOW (window));
  context = gtk_widget_get_style_context (window);
  gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOOLTIP);

  /* FIXME: don't hardcode the padding */
  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
  gtk_widget_set_margin_start (box, 6);
  gtk_widget_set_margin_end (box, 6);
  gtk_widget_set_margin_top (box, 6);
  gtk_widget_set_margin_bottom (box, 6);
  gtk_container_add (GTK_CONTAINER (window), box);
  gtk_widget_show (box);

  image = gtk_image_new ();
  gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);

  label = gtk_label_new ("");
  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
  gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);

  tooltip->window = window;
  tooltip->box = box;
  tooltip->image = image;
  tooltip->label = label;
  tooltip->custom_widget = NULL;
}
static GtkWidget *
padded_label_new (char *text)
{
        GtkWidget *widget;
        widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
        gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
        gtk_widget_set_margin_top (widget, 10);
        gtk_widget_set_margin_bottom (widget, 10);
        gtk_box_pack_start (GTK_BOX (widget), gtk_label_new (text), FALSE, FALSE, 0);
        return widget;
}
Esempio n. 18
0
void
clocksource (GtkWidget *box, GtkWidget *button)
{
    GtkWidget *label;
    GtkWidget *pbutton;
    GtkWidget *child_box1;
    GtkWidget *separator;
    config_t config;
    GtkPassedClockSourceData *pdata;
    
    child_box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
    label = gtk_label_new ("Clocksource"); 
    separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);

    pdata = g_slice_new (GtkPassedClockSourceData);
    pdata -> pbutton = gtk_button_new_with_label (get_clocksource ());
    pdata -> popover = NULL;

    gtk_widget_set_tooltip_text (pdata -> pbutton, "Choose a specific wall clock.");
    gtk_button_set_relief (GTK_BUTTON (pdata -> pbutton), GTK_RELIEF_NONE);
    gtk_widget_override_font (label, pango_font_description_from_string ("Cantarell Bold 11.5"));
    //label_underline (label);

    /* Pack box. */
    gtk_box_pack_start (GTK_BOX (child_box1), label, FALSE, FALSE, 2);
    gtk_box_pack_start (GTK_BOX (child_box1), pdata -> pbutton, FALSE, FALSE, 2);
    gtk_box_pack_start (GTK_BOX (child_box1), separator, FALSE, FALSE, 2);    
    gtk_box_pack_start (GTK_BOX (box), child_box1, FALSE, FALSE, 2);
  
    gtk_widget_set_size_request (pdata -> pbutton, 80, 10);
    gtk_widget_set_halign (label, GTK_ALIGN_START);
    gtk_widget_set_margin_start (label, 10);
    gtk_widget_set_margin_start (pdata -> pbutton, 10);
    gtk_widget_set_margin_top (separator, 6);
    gtk_widget_set_margin_top (child_box1, 6);
    gtk_widget_set_name (pdata -> pbutton, "clocksource-button");
    gtk_widget_set_name (label, "clocksource-label-title");

    g_signal_connect (pdata -> pbutton, "clicked", G_CALLBACK (popover_button_clicked_cb), pdata);
    g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), pdata);
}
static void
photos_delete_notification_constructed (GObject *object)
{
  PhotosDeleteNotification *self = PHOTOS_DELETE_NOTIFICATION (object);
  gchar *msg;
  GtkWidget *close;
  GtkWidget *image;
  GtkWidget *label;
  GtkWidget *undo;
  guint length;

  G_OBJECT_CLASS (photos_delete_notification_parent_class)->constructed (object);

  length = g_list_length (self->items);
  if (length == 1)
    {
      const gchar *name;

      name = photos_base_item_get_name_with_fallback (PHOTOS_BASE_ITEM (self->items->data));
      msg = g_strdup_printf (_("“%s” deleted"), name);
    }
  else
    msg = g_strdup_printf (ngettext ("%d item deleted", "%d items deleted", length), length);

  label = gtk_label_new (msg);
  gtk_widget_set_halign (label, GTK_ALIGN_START);
  gtk_widget_set_hexpand (label, TRUE);
  gtk_container_add (GTK_CONTAINER (self), label);
  g_free (msg);

  undo = gtk_button_new_with_label (_("Undo"));
  gtk_widget_set_valign (undo, GTK_ALIGN_CENTER);
  gtk_container_add (GTK_CONTAINER (self), undo);
  g_signal_connect_swapped (undo, "clicked", G_CALLBACK (photos_delete_notification_undo_clicked), self);

  image = gtk_image_new_from_icon_name (PHOTOS_ICON_WINDOW_CLOSE_SYMBOLIC, GTK_ICON_SIZE_INVALID);
  gtk_widget_set_margin_bottom (image, 2);
  gtk_widget_set_margin_top (image, 2);
  gtk_image_set_pixel_size (GTK_IMAGE (image), 16);

  close = gtk_button_new ();
  gtk_widget_set_valign (close, GTK_ALIGN_CENTER);
  gtk_button_set_focus_on_click (GTK_BUTTON (close), FALSE);
  gtk_button_set_relief (GTK_BUTTON (close), GTK_RELIEF_NONE);
  gtk_button_set_image (GTK_BUTTON (close), image);
  gtk_container_add (GTK_CONTAINER (self), close);
  g_signal_connect_swapped (close, "clicked", G_CALLBACK (photos_delete_notification_delete_items), self);

  photos_notification_manager_add_notification (PHOTOS_NOTIFICATION_MANAGER (self->ntfctn_mngr),
                                                GTK_WIDGET (self));

  self->timeout_id = g_timeout_add_seconds (DELETE_TIMEOUT, photos_delete_notification_timeout, self);
}
Esempio n. 20
0
/* We are trying to implement the following rules here:
 *
 * rule 1: never ever show separators for empty sections
 * rule 2: always show a separator if there is a label
 * rule 3: don't show a separator for the first section
 * rule 4: don't show a separator for the following sections if there are
 *         no items before it
 * rule 5: never show separators directly above or below an iconic box
 * (rule 6: these rules don't apply exactly the same way for subsections)
 */
void
gtk_menu_section_box_sync_separators (GtkMenuSectionBox *box,
                                      MenuData          *data)
{
  GtkWidget *parent_widget;
  gboolean previous_section_is_iconic;
  gboolean should_have_separator;
  gboolean should_have_top_margin = FALSE;
  gboolean is_not_empty_item;
  gboolean has_separator;
  gboolean has_label;
  gboolean separator_condition;
  gint n_items_before;

  n_items_before =  data->n_items;
  previous_section_is_iconic = data->previous_is_iconic;

  gtk_container_foreach (GTK_CONTAINER (box->item_box), gtk_menu_section_box_sync_item, data);

  is_not_empty_item = (data->n_items > n_items_before);

  if (is_not_empty_item)
    data->previous_is_iconic = box->iconic;

  if (box->separator == NULL)
    return;

  has_separator = gtk_widget_get_parent (box->separator) != NULL;
  has_label = !GTK_IS_SEPARATOR (box->separator);

  separator_condition = has_label ? TRUE : n_items_before > 0 &&
                                           box->depth <= 1 &&
                                           !previous_section_is_iconic &&
                                           !box->iconic;

  should_have_separator = separator_condition && is_not_empty_item;

  should_have_top_margin = !should_have_separator &&
                           (box->depth <= 1 || box->iconic) &&
                           n_items_before > 0 &&
                           is_not_empty_item;

  gtk_widget_set_margin_top (GTK_WIDGET (box->item_box), should_have_top_margin ? 10 : 0);

  if (should_have_separator == has_separator)
    return;

  if (should_have_separator)
    gtk_box_pack_start (GTK_BOX (box), box->separator, FALSE, FALSE, 0);
  else
    gtk_container_remove (GTK_CONTAINER (box), box->separator);
}
Esempio n. 21
0
static void
create_properties_widget ()
{
	pwidget = gtk_vbox_new (FALSE, 10);

	GtkWidget *finish_label = gtk_label_new (NULL);
	gtk_label_set_markup (GTK_LABEL(finish_label), "<b>When Finished:</b>");

	GtkWidget *buttonbox = gtk_hbutton_box_new ();
	open   = gtk_check_button_new_with_label ("Open File");
	notify = gtk_check_button_new_with_label ("Show Notification");
	open_location = gtk_check_button_new_with_label ("Open Location");

	gtk_box_pack_start (GTK_BOX(buttonbox), notify, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX(buttonbox), open, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX(buttonbox), open_location, FALSE, FALSE, 0);

	GtkWidget *comment_label = gtk_label_new (NULL);
	gtk_label_set_markup (GTK_LABEL(comment_label), "<b>Comment:</b>");

	GtkWidget *text_view  = gtk_text_view_new ();
	comment = gtk_text_view_get_buffer (GTK_TEXT_VIEW(text_view));
	gtk_widget_set_size_request (text_view, -1, 60);
	gtk_text_view_set_left_margin (GTK_TEXT_VIEW(text_view), 10);
	gtk_text_view_set_right_margin (GTK_TEXT_VIEW(text_view), 10);

	gtk_box_pack_start (GTK_BOX(pwidget), finish_label, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX(pwidget), buttonbox, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX(pwidget), comment_label, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX(pwidget), text_view, FALSE, FALSE, 0);
	gtk_button_box_set_layout (GTK_BUTTON_BOX(buttonbox), GTK_BUTTONBOX_START);

	gtk_misc_set_alignment (GTK_MISC(finish_label), 0.0, 0.5);
	gtk_misc_set_alignment (GTK_MISC(comment_label), 0.0, 0.5);

	gtk_widget_set_margin_left (pwidget, 15);
	gtk_widget_set_margin_left (buttonbox, 15);
	gtk_widget_set_margin_left  (text_view, 15);
	gtk_widget_set_margin_right (text_view, 20);
	gtk_widget_set_margin_top  (pwidget, 15);

	g_signal_connect (notify, "toggled", G_CALLBACK (on_toggle),
					  GINT_TO_POINTER (G_DOWNLOADABLE_FINISH_ACTION_NOTIFY));
	g_signal_connect (open, "toggled", G_CALLBACK (on_toggle),
					  GINT_TO_POINTER (G_DOWNLOADABLE_FINISH_ACTION_OPEN));
	g_signal_connect (open_location, "toggled", G_CALLBACK (on_toggle),
					  GINT_TO_POINTER (G_DOWNLOADABLE_FINISH_ACTION_OPEN_LOCATION));
	g_signal_connect (text_view, "focus-out-event", G_CALLBACK (on_comment_save), NULL);

	gtk_widget_show_all (pwidget);
}
Esempio n. 22
0
static void
add_dns_row (CEPageIP6   *page,
             const gchar *address)
{
        GtkWidget *row;
        GtkWidget *row_box;
        GtkWidget *label;
        GtkWidget *widget;
        GtkWidget *delete_button;
        GtkWidget *image;

        row = gtk_list_box_row_new ();
        gtk_widget_set_can_focus (row, FALSE);

        row_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
        label = gtk_label_new (_("Server"));
        gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
        gtk_box_pack_start (GTK_BOX (row_box), label, FALSE, FALSE, 0);
        widget = gtk_entry_new ();
        gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
        g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
        g_object_set_data (G_OBJECT (row), "address", widget);
        gtk_entry_set_text (GTK_ENTRY (widget), address);
        gtk_widget_set_margin_left (widget, 10);
        gtk_widget_set_margin_right (widget, 10);
        gtk_widget_set_hexpand (widget, TRUE);
        gtk_box_pack_start (GTK_BOX (row_box), widget, TRUE, TRUE, 0);

        delete_button = gtk_button_new ();
        gtk_style_context_add_class (gtk_widget_get_style_context (delete_button), "image-button");
        g_signal_connect (delete_button, "clicked", G_CALLBACK (remove_row), page);
        image = gtk_image_new_from_icon_name ("user-trash-symbolic", GTK_ICON_SIZE_MENU);
        atk_object_set_name (gtk_widget_get_accessible (delete_button), _("Delete DNS Server"));
        gtk_button_set_image (GTK_BUTTON (delete_button), image);
        gtk_box_pack_start (GTK_BOX (row_box), delete_button, FALSE, FALSE, 0);
        g_object_set_data (G_OBJECT (row), "delete-button", delete_button);

        gtk_widget_set_margin_left (row_box, 10);
        gtk_widget_set_margin_right (row_box, 10);
        gtk_widget_set_margin_top (row_box, 10);
        gtk_widget_set_margin_bottom (row_box, 10);
        gtk_widget_set_halign (row_box, GTK_ALIGN_FILL);

        gtk_container_add (GTK_CONTAINER (row), row_box);
        gtk_widget_show_all (row);
        gtk_container_add (GTK_CONTAINER (page->dns_list), row);

        update_row_sensitivity (page, page->dns_list);
}
Esempio n. 23
0
static void
eog_statusbar_init (EogStatusbar *statusbar)
{
	EogStatusbarPrivate *priv;
	GtkWidget *vbox;

	statusbar->priv = EOG_STATUSBAR_GET_PRIVATE (statusbar);
	priv = statusbar->priv;

	priv->img_num_label = gtk_label_new (NULL);
	gtk_widget_set_size_request (priv->img_num_label, 100, 10);
	gtk_widget_show (priv->img_num_label);

	gtk_box_pack_end (GTK_BOX (statusbar),
			  priv->img_num_label,
			  FALSE,
			  TRUE,
			  0);

	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);

	gtk_box_pack_end (GTK_BOX (statusbar),
			  vbox,
			  FALSE,
			  FALSE,
			  2);

	statusbar->priv->progressbar = gtk_progress_bar_new ();

	gtk_box_pack_end (GTK_BOX (vbox),
			  priv->progressbar,
			  TRUE,
			  TRUE,
			  0);

	/* Set margins by hand to avoid causing redraws due to the statusbar
	 * becoming too small for the progressbar */
	gtk_widget_set_margin_left (priv->progressbar, 2);
	gtk_widget_set_margin_right (priv->progressbar, 2);
	gtk_widget_set_margin_top (priv->progressbar, 1);
	gtk_widget_set_margin_bottom (priv->progressbar, 1);

	gtk_widget_set_size_request (priv->progressbar, -1, 10);

	gtk_widget_show (vbox);

	gtk_widget_hide (statusbar->priv->progressbar);

}
static void
maybe_add_category_view (GnomeControlCenter *shell,
                         const char         *name)
{
  GtkTreeModel *filter;
  GtkWidget *categoryview;

  if (g_hash_table_lookup (shell->priv->category_views, name) != NULL)
    return;

  if (g_hash_table_size (shell->priv->category_views) > 0)
    {
      GtkWidget *separator;
      separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
      gtk_widget_set_margin_top (separator, 11);
      gtk_widget_set_margin_bottom (separator, 10);
      gtk_box_pack_start (GTK_BOX (shell->priv->main_vbox), separator, FALSE, FALSE, 0);
      gtk_widget_show (separator);
    }

  /* create new category view for this category */
  filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (shell->priv->store),
                                      NULL);
  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter),
                                          (GtkTreeModelFilterVisibleFunc) category_filter_func,
                                          g_strdup (name), g_free);

  categoryview = cc_shell_category_view_new (name, filter);
  gtk_box_pack_start (GTK_BOX (shell->priv->main_vbox), categoryview, FALSE, TRUE, 0);

  g_signal_connect (cc_shell_category_view_get_item_view (CC_SHELL_CATEGORY_VIEW (categoryview)),
                    "desktop-item-activated",
                    G_CALLBACK (item_activated_cb), shell);

  gtk_widget_show (categoryview);

  g_signal_connect (cc_shell_category_view_get_item_view (CC_SHELL_CATEGORY_VIEW (categoryview)),
                    "focus-in-event",
                    G_CALLBACK (category_focus_in), shell);
  g_signal_connect (cc_shell_category_view_get_item_view (CC_SHELL_CATEGORY_VIEW (categoryview)),
                    "focus-out-event",
                    G_CALLBACK (category_focus_out), shell);
  g_signal_connect (cc_shell_category_view_get_item_view (CC_SHELL_CATEGORY_VIEW (categoryview)),
                    "keynav-failed",
                    G_CALLBACK (keynav_failed), shell);

  g_hash_table_insert (shell->priv->category_views, g_strdup (name), categoryview);
}
Esempio n. 25
0
static void
eom_statusbar_init (EomStatusbar *statusbar)
{
	EomStatusbarPrivate *priv;
	GtkWidget *vbox;

	statusbar->priv = EOM_STATUSBAR_GET_PRIVATE (statusbar);
	priv = statusbar->priv;

#if GTK_CHECK_VERSION (3, 0, 0)
	gtk_widget_set_margin_top (GTK_WIDGET (statusbar), 0);
	gtk_widget_set_margin_bottom (GTK_WIDGET (statusbar), 0);
#endif

	priv->img_num_label = gtk_label_new (NULL);
	gtk_widget_set_size_request (priv->img_num_label, 100, 10);
	gtk_widget_show (priv->img_num_label);

	gtk_box_pack_end (GTK_BOX (statusbar),
			  priv->img_num_label,
			  FALSE,
			  TRUE,
			  0);

	vbox = gtk_vbox_new (FALSE, 0);

	gtk_box_pack_end (GTK_BOX (statusbar),
			  vbox,
			  FALSE,
			  FALSE,
			  2);

	statusbar->priv->progressbar = gtk_progress_bar_new ();

	gtk_box_pack_end (GTK_BOX (vbox),
			  priv->progressbar,
			  TRUE,
			  TRUE,
			  2);

	gtk_widget_set_size_request (priv->progressbar, -1, 10);

	gtk_widget_show (vbox);

	gtk_widget_hide (statusbar->priv->progressbar);

}
static GtkWidget *
more_widget_new (void)
{
        GtkWidget *widget;
        GtkWidget *arrow;

        widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
        gtk_widget_set_tooltip_text (widget, _("More…"));

        arrow = gtk_image_new_from_icon_name ("view-more-symbolic", GTK_ICON_SIZE_MENU);
        gtk_style_context_add_class (gtk_widget_get_style_context (arrow), "dim-label");
        gtk_widget_set_margin_top (widget, 10);
        gtk_widget_set_margin_bottom (widget, 10);
        gtk_misc_set_alignment (GTK_MISC (arrow), 0.5, 0.5);
        gtk_box_pack_start (GTK_BOX (widget), arrow, TRUE, TRUE, 0);

        return widget;
}
static GtkListBoxRow *
more_widget_new (void)
{
        GtkWidget *box, *row;
        GtkWidget *arrow;

        row = gtk_list_box_row_new ();
        box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
        gtk_container_add (GTK_CONTAINER (row), box);
        gtk_widget_set_tooltip_text (box, _("More…"));

        arrow = gtk_image_new_from_icon_name ("view-more-symbolic", GTK_ICON_SIZE_MENU);
        gtk_style_context_add_class (gtk_widget_get_style_context (arrow), "dim-label");
        gtk_widget_set_margin_top (box, 10);
        gtk_widget_set_margin_bottom (box, 10);
        gtk_box_pack_start (GTK_BOX (box), arrow, TRUE, TRUE, 0);

        return GTK_LIST_BOX_ROW (row);
}
static void
cc_mouse_panel_init (CcMousePanel *self)
{
  CcMousePanelPrivate *priv;

  priv = self->priv = MOUSE_PANEL_PRIVATE (self);
  g_resources_register (cc_mouse_get_resource ());

  priv->prefs_widget = cc_mouse_properties_new ();
  priv->test_widget = cc_mouse_test_new ();

  gtk_widget_set_margin_start (priv->prefs_widget, 6);
  gtk_widget_set_margin_end (priv->prefs_widget, 6);
  gtk_widget_set_margin_top (priv->prefs_widget, 6);
  gtk_widget_set_margin_bottom (priv->prefs_widget, 6);

  gtk_container_add (GTK_CONTAINER (self), priv->prefs_widget);
  gtk_widget_show (priv->prefs_widget);
  gtk_widget_show (priv->test_widget);
}
static void
setup_model (GnomeControlCenter *shell)
{
  GnomeControlCenterPrivate *priv = shell->priv;

  gtk_widget_set_margin_top (shell->priv->main_vbox, 8);
  gtk_widget_set_margin_bottom (shell->priv->main_vbox, 8);
  gtk_widget_set_margin_left (shell->priv->main_vbox, 12);
  gtk_widget_set_margin_right (shell->priv->main_vbox, 12);
  gtk_container_set_focus_vadjustment (GTK_CONTAINER (shell->priv->main_vbox),
                                       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (shell->priv->scrolled_window)));

  priv->store = (GtkListStore *) cc_shell_model_new ();
  priv->category_views = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
  priv->menu_tree = gmenu_tree_new_for_path (MENUDIR "/gnomecc.menu", 0);

  reload_menu (shell);

  g_signal_connect (priv->menu_tree, "changed", G_CALLBACK (on_menu_changed), shell);
}
static void
photos_empty_results_box_add_primary_label (PhotosEmptyResultsBox *self)
{
  GtkWidget *primary_label;
  const gchar *text = NULL;
  g_autofree gchar *label = NULL;

  switch (self->mode)
    {
    case PHOTOS_WINDOW_MODE_COLLECTIONS:
      text = _("No albums found");
      break;

    case PHOTOS_WINDOW_MODE_FAVORITES:
      text = _("Starred photos will appear here");
      break;

    /* TODO: Don't show a collection if there are no screenshots in
     * the relevant locations.
     */
    case PHOTOS_WINDOW_MODE_COLLECTION_VIEW:
    case PHOTOS_WINDOW_MODE_IMPORT:
    case PHOTOS_WINDOW_MODE_OVERVIEW:
    case PHOTOS_WINDOW_MODE_SEARCH:
      text = _("No photos found");
      break;

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

  label = g_strconcat ("<b><span size=\"large\">", text, "</span></b>", NULL);
  primary_label = gtk_label_new (label);
  gtk_widget_set_margin_top (GTK_WIDGET (primary_label), 9);
  gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
  gtk_container_add (GTK_CONTAINER (self), primary_label);
}