Esempio n. 1
0
static void
change_subtitle (GtkButton *button, gpointer data)
{
  GtkWidget *headerbar = GTK_WIDGET (data);

  if (gtk_header_bar_get_subtitle (GTK_HEADER_BAR (headerbar)) == NULL)
    {
      gtk_header_bar_set_subtitle (GTK_HEADER_BAR (headerbar), "(subtle subtitle)");
    }
  else
    {
      gtk_header_bar_set_subtitle (GTK_HEADER_BAR (headerbar), NULL);
    }
}
Esempio n. 2
0
static void
gs_editor_refresh_file (GsEditor *self, GFile *file)
{
	GtkWidget *widget;

	/* set subtitle */
	widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "headerbar_main"));
	if (file != NULL) {
		g_autofree gchar *basename = g_file_get_basename (file);
		gtk_header_bar_set_subtitle (GTK_HEADER_BAR (widget), basename);
	} else {
		gtk_header_bar_set_subtitle (GTK_HEADER_BAR (widget), NULL);
	}
}
Esempio n. 3
0
static void
change_subtitle (GtkButton *button, gpointer data)
{
  if (!GTK_IS_HEADER_BAR (header))
    return;

  if (gtk_header_bar_get_subtitle (GTK_HEADER_BAR (header)) == NULL)
    {
      gtk_header_bar_set_subtitle (GTK_HEADER_BAR (header), "(subtle subtitle)");
    }
  else
    {
      gtk_header_bar_set_subtitle (GTK_HEADER_BAR (header), NULL);
    }
}
Esempio n. 4
0
static void
selection_changed_cb (GtkButton * button, gpointer vdata)
{
  int i;
  struct filter_data * data = vdata;

  // If the button isn't active, we are not interested in it.
  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) return;

  for (i = 0; i < MAX_FILTERS_ON_TOOLBAR; i++) {
    if (GTK_WIDGET (button) == data->filters[i].widget) {
      data->active_activity_type = data->filters[i].type;

      switch (data->active_activity_type) {
        case ACTIVITY_FILTER_ALL:
        gtk_header_bar_set_subtitle(GTK_HEADER_BAR (data->header_bar), _("All"));
        break;

        case ACTIVITY_FILTER_DOWNLOADING:
        gtk_header_bar_set_subtitle(GTK_HEADER_BAR (data->header_bar), _("Downloading"));
        break;

        case ACTIVITY_FILTER_SEEDING:
        gtk_header_bar_set_subtitle(GTK_HEADER_BAR (data->header_bar), _("Seeding"));
        break;

        case ACTIVITY_FILTER_ACTIVE:
        gtk_header_bar_set_subtitle(GTK_HEADER_BAR (data->header_bar), _("Active"));
        break;

        default:
        break;
      }
    }
  }

  /* refilter */
  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (data->filter_model));
}
Esempio n. 5
0
void
say (char *fmt, ...)
{
  va_list ap;
  char buf[200];

  if (test_computer_play > 0) return;
  va_start (ap, fmt);
  g_vsnprintf (buf, 200, fmt, ap);
  va_end (ap);

  gtk_header_bar_set_subtitle (GTK_HEADER_BAR (hbar), buf);

}
void WebInspectorProxy::updateInspectorWindowTitle() const
{
    ASSERT(m_inspectorWindow);
    if (m_inspectedURLString.isEmpty()) {
        gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), _("Web Inspector"));
        return;
    }

#if GTK_CHECK_VERSION(3, 10, 0)
    gtk_header_bar_set_title(GTK_HEADER_BAR(m_headerBar), _("Web Inspector"));
    gtk_header_bar_set_subtitle(GTK_HEADER_BAR(m_headerBar), m_inspectedURLString.utf8().data());
#else
    GUniquePtr<gchar> title(g_strdup_printf("%s - %s", _("Web Inspector"), m_inspectedURLString.utf8().data()));
    gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), title.get());
#endif
}
Esempio n. 7
0
static void
conversation_page_update_title_and_status (ConversationPage* self)
{
  g_free (self->priv->title);
  guint unread_count = self->priv->conversation->get_unread_messages_count ();
  if (unread_count > 0) {

    self->priv->title = g_strdup_printf ("[%d] %s",
					 unread_count,
					 self->priv->conversation->get_title ().c_str ());
  } else {

    self->priv->title = g_strdup_printf ("%s",
					 self->priv->conversation->get_title ().c_str ());
  }
  gtk_header_bar_set_title (GTK_HEADER_BAR (self->priv->header), self->priv->title);
  gtk_header_bar_set_subtitle (GTK_HEADER_BAR (self->priv->header),
			       self->priv->conversation->get_status ().c_str ());
}
static void
set_dialog_properties (GtkAppChooserDialog *self)
{
  gchar *name;
  gchar *extension;
  gchar *description;
  gchar *string;
  gboolean unknown;
  gchar *title;
  gchar *subtitle;
  gboolean use_header;
  GtkWidget *header;

  name = NULL;
  extension = NULL;
  description = NULL;
  unknown = TRUE;

  if (self->priv->gfile != NULL)
    {
      name = g_file_get_basename (self->priv->gfile);
      extension = get_extension (name);
    }

  if (self->priv->content_type)
    {
      description = g_content_type_get_description (self->priv->content_type);
      unknown = g_content_type_is_unknown (self->priv->content_type);
    }

  if (name != NULL)
    {
      title = g_strdup (_("Select Application"));
      /* Translators: %s is a filename */
      subtitle = g_strdup_printf (_("Opening “%s”."), name);
      string = g_strdup_printf (_("No applications found for “%s”"), name);
    }
  else
    {
      title = g_strdup (_("Select Application"));
      /* Translators: %s is a file type description */
      subtitle = g_strdup_printf (_("Opening “%s” files."), 
                                  unknown ? self->priv->content_type : description);
      string = g_strdup_printf (_("No applications found for “%s” files"),
                                unknown ? self->priv->content_type : description);
    }

  g_object_get (self, "use-header-bar", &use_header, NULL); 
  if (use_header)
    {
      header = gtk_dialog_get_header_bar (GTK_DIALOG (self));
      gtk_header_bar_set_title (GTK_HEADER_BAR (header), title);
      gtk_header_bar_set_subtitle (GTK_HEADER_BAR (header), subtitle);
    }
  else
    {
      gtk_window_set_title (GTK_WINDOW (self), _("Select Application"));
    }

  if (self->priv->heading != NULL)
    {
      gtk_label_set_markup (GTK_LABEL (self->priv->label), self->priv->heading);
      gtk_widget_show (self->priv->label);
    }
  else
    {
      gtk_widget_hide (self->priv->label);
    }

  gtk_app_chooser_widget_set_default_text (GTK_APP_CHOOSER_WIDGET (self->priv->app_chooser_widget),
                                           string);

  g_free (title);
  g_free (subtitle);
  g_free (name);
  g_free (extension);
  g_free (description);
  g_free (string);
}
Esempio n. 9
0
/*********************************************************************** Menu */
void
bmd_construct_menu (GtkApplication *app, gpointer data)
{
	GtkWidget *headerbar;
	// the application menu displayed in the GNOME panel
	GMenu *appmenu;
	GMenu *editmenu;

	GtkWidget *openbutton;
	GtkWidget *savebutton;

	// the menu displayed as a popover below the gears button
	GMenu *gearmenu;
	GtkWidget *gearmenubutton;
	GtkWidget *gearicon;

	bmd_widgets *a = (bmd_widgets *) data;

	// define keyboard accelerators
	const gchar *open_accels[2] = { "<Ctrl>O", NULL };
	const gchar *save_accels[2] = { "<Ctrl>S", NULL };
	const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
	const gchar *add_accels[2] = { "<Ctrl>A", NULL };
	const gchar *del_accels[2] = { "<Ctrl>D", NULL };
	const gchar *find_accels[2] = { "<Ctrl>F", NULL };
	const gchar *help_accels[2] = { "F1", NULL };

	// create and fill in the application menu in the GNOME panel
	appmenu = g_menu_new();
	g_menu_append (appmenu, "About", "app.about");
	g_menu_append (appmenu, "Help", "app.help");
	g_menu_append (appmenu, "_Quit", "app.quit");
	gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (appmenu));
	g_object_unref (appmenu);

	// create a headerbar
	headerbar = gtk_header_bar_new ();
	gtk_widget_show (headerbar);
	gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar), "Book Management");
	gtk_header_bar_set_subtitle (GTK_HEADER_BAR (headerbar), "Simple Demo Application");
	gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (headerbar), TRUE);
	gtk_window_set_titlebar (GTK_WINDOW (a->window), headerbar);

	// create an OPEN button, add it to the headerbar and connect the callbacks
	openbutton = gtk_button_new_with_label ("Open");
	gtk_header_bar_pack_start (GTK_HEADER_BAR (headerbar), openbutton);
	gtk_actionable_set_action_name (GTK_ACTIONABLE (openbutton), "app.open");

	// create the gear menu button
	gearmenubutton = gtk_menu_button_new();
	gearicon = gtk_image_new_from_icon_name ("emblem-system-symbolic",
						 GTK_ICON_SIZE_SMALL_TOOLBAR);
	gtk_button_set_image (GTK_BUTTON (gearmenubutton), gearicon);
	gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), gearmenubutton);
	// create a menu for the gear button
	gearmenu = g_menu_new();
	g_menu_append (gearmenu, "Save As ...", "app.saveAs");
	editmenu = g_menu_new();
	g_menu_append (editmenu, "_Find", "app.find");
	g_menu_append (editmenu, "_Add", "app.add");
	g_menu_append (editmenu, "_Delete", "app.delete");
	g_menu_append_section (gearmenu, NULL, G_MENU_MODEL (editmenu));
	gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (gearmenubutton),
					G_MENU_MODEL (gearmenu));
	g_object_unref (editmenu);
	g_object_unref (gearmenu);

	// create an SAVE button, add it to the headerbar and connect the callbacks
	savebutton = gtk_button_new_with_label ("Save");
	gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), savebutton);
	gtk_actionable_set_action_name (GTK_ACTIONABLE (savebutton), "app.save");

	// connect keyboard accelerators
	gtk_application_set_accels_for_action (GTK_APPLICATION (app),
					       "app.open", open_accels);
	gtk_application_set_accels_for_action (GTK_APPLICATION (app),
					       "app.save", save_accels);
	gtk_application_set_accels_for_action (GTK_APPLICATION (app),
					       "app.quit", quit_accels);
	gtk_application_set_accels_for_action (GTK_APPLICATION (app),
					       "app.add", add_accels);
	gtk_application_set_accels_for_action (GTK_APPLICATION (app),
					       "app.delete", del_accels);
	gtk_application_set_accels_for_action (GTK_APPLICATION (app),
					       "app.find", find_accels);
	gtk_application_set_accels_for_action (GTK_APPLICATION (app),
					       "app.help", help_accels);
}
Esempio n. 10
0
static void
ev_window_title_update (EvWindowTitle *window_title)
{
	GtkWindow *window = GTK_WINDOW (window_title->window);
	GtkHeaderBar *toolbar = GTK_HEADER_BAR (ev_window_get_toolbar (EV_WINDOW (window)));
	char *title = NULL, *p;
	char *subtitle = NULL, *title_header = NULL;

        if (window_title->type == EV_WINDOW_TITLE_RECENT) {
                gtk_header_bar_set_subtitle (toolbar, NULL);
                gtk_window_set_title (window, _("Recent Documents"));
                return;
        }

	if (window_title->doc_title && window_title->uri) {
                title = g_strdup (window_title->doc_title);
                ev_window_title_sanitize_title (window_title, &title);

		subtitle = get_filename_from_uri (window_title->uri);

		title_header = title;
		title = g_strdup_printf ("%s — %s", subtitle, title);

                for (p = title; *p; ++p) {
                        /* an '\n' byte is always ASCII, no need for UTF-8 special casing */
                        if (*p == '\n')
                                *p = ' ';
                }
	} else if (window_title->uri) {
		title = get_filename_from_uri (window_title->uri);
	} else if (!title) {
		title = g_strdup (_("Document Viewer"));
	}

	switch (window_title->type) {
	case EV_WINDOW_TITLE_DOCUMENT:
		gtk_window_set_title (window, title);
		if (title_header && subtitle) {
			gtk_header_bar_set_title (toolbar, title_header);
			gtk_header_bar_set_subtitle (toolbar, subtitle);
		}
		break;
	case EV_WINDOW_TITLE_PASSWORD: {
                gchar *password_title;

		password_title = g_strdup_printf ("%s — %s", title, _("Password Required"));
		gtk_window_set_title (window, password_title);
		g_free (password_title);

                gtk_header_bar_set_title (toolbar, _("Password Required"));
                gtk_header_bar_set_subtitle (toolbar, title);
        }
		break;
        case EV_WINDOW_TITLE_RECENT:
                g_assert_not_reached ();
                break;
	}

	g_free (title);
	g_free (subtitle);
	g_free (title_header);
}