Exemplo n.º 1
0
/****************************************************************
  Worklist editor window used by the global worklist report.
*****************************************************************/
static void popup_worklist(struct global_worklist *pgwl)
{
  GtkWidget *shell;

  if (!(shell = get_worklist(global_worklist_id(pgwl)))) {
    GtkWidget *editor;

    shell = gtk_dialog_new_with_buttons(global_worklist_name(pgwl),
                                        GTK_WINDOW(worklists_shell),
                                        GTK_DIALOG_DESTROY_WITH_PARENT,
                                        GTK_STOCK_CLOSE,
                                        GTK_RESPONSE_CLOSE,
                                        NULL);
    gtk_window_set_role(GTK_WINDOW(shell), "worklist");
    gtk_window_set_position(GTK_WINDOW(shell), GTK_WIN_POS_MOUSE);
    g_signal_connect(shell, "response", G_CALLBACK(worklist_response), NULL);
    gtk_window_set_default_size(GTK_WINDOW(shell), 500, 400);
  
    editor = create_worklist();
    reset_global_worklist(editor, pgwl);
    insert_worklist(global_worklist_id(pgwl), editor);

    gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(shell))), editor);
    gtk_widget_show(editor);

    refresh_worklist(editor);
  }

  gtk_window_present(GTK_WINDOW(shell));
}
static void
shell_show_overview_page (GnomeControlCenter *center)
{
  GnomeControlCenterPrivate *priv = center->priv;

  notebook_select_page (priv->notebook, priv->scrolled_window);

  if (priv->current_panel)
    notebook_remove_page (priv->notebook, priv->current_panel);
  priv->current_panel = NULL;

  /* clear the search text */
  g_free (priv->filter_string);
  priv->filter_string = g_strdup ("");
  gtk_entry_set_text (GTK_ENTRY (priv->search_entry), "");
  gtk_widget_grab_focus (priv->search_entry);

  gtk_lock_button_set_permission (GTK_LOCK_BUTTON (priv->lock_button), NULL);

  /* reset window title and icon */
  gtk_window_set_role (GTK_WINDOW (priv->window), NULL);
  gtk_window_set_title (GTK_WINDOW (priv->window), priv->default_window_title);
  gtk_window_set_default_icon_name (priv->default_window_icon);
  gtk_window_set_icon_name (GTK_WINDOW (priv->window),
                            priv->default_window_icon);

  cc_shell_set_active_panel (CC_SHELL (center), NULL);

  /* clear any custom widgets */
  _shell_remove_all_custom_widgets (priv);
}
Exemplo n.º 3
0
JNIEXPORT void JNICALL
Java_org_gnome_gtk_GtkWindow_gtk_1window_1set_1role
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jstring _role
)
{
	GtkWindow* self;
	const gchar* role;

	// convert parameter self
	self = (GtkWindow*) _self;

	// convert parameter role
	role = (const gchar*) bindings_java_getString(env, _role);
	if (role == NULL) {
		return; // Java Exception already thrown
	}

	// call function
	gtk_window_set_role(self, role);

	// cleanup parameter self

	// cleanup parameter role
	bindings_java_releaseString(role);
}
Exemplo n.º 4
0
static void create_dialog()
{
  dialog = gtk_dialog_new_with_buttons(
             _("Object defaults"),
             NULL, 0,
             GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
             GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
             GTK_STOCK_OK, GTK_RESPONSE_OK,
             NULL);

  gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_OK);

  dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
  
  gtk_window_set_role (GTK_WINDOW (dialog), "defaults_window");

  g_signal_connect(G_OBJECT (dialog), "response",
		   G_CALLBACK(defaults_respond), NULL);
  g_signal_connect(G_OBJECT(dialog), "delete_event",
		   G_CALLBACK(gtk_widget_hide), NULL);

  no_defaults_dialog = gtk_label_new(_("This object has no defaults."));
  gtk_widget_show (no_defaults_dialog);

  g_object_ref_sink(G_OBJECT(no_defaults_dialog));
}
Exemplo n.º 5
0
/* Splash Screen Initialization Function */
void splash_screen_start(void)
{
    GtkWidget *image, *vbox, *ver_lbl;
    GdkColor color;
    GdkPixbuf *pixbuf;
    gchar *version_string;

    // Is Splash Screen started?
    if (splashscreen.enabled == 1)
        return;

    // Make the Splash Screen
     splashscreen.splash = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     gtk_window_set_title(GTK_WINDOW(splashscreen.splash), "GFM Loading...");
     gtk_window_set_position(GTK_WINDOW(splashscreen.splash), GTK_WIN_POS_CENTER_ALWAYS);
     gtk_window_set_decorated(GTK_WINDOW(splashscreen.splash), FALSE);
     gtk_window_set_role(GTK_WINDOW(splashscreen.splash), "splash");
     gtk_window_set_resizable(GTK_WINDOW(splashscreen.splash), FALSE);
     gtk_window_set_default_size(GTK_WINDOW(splashscreen.splash), 150, 110); // 150x110 pixels

     // Set the Colors
     color.red = 65535;
     color.green = 65535;
     color.blue = 65535;
     gtk_widget_modify_bg(splashscreen.splash, GTK_STATE_NORMAL, &color);

     // Create a VBOX
     vbox = gtk_vbox_new(FALSE, 0);
     gtk_container_add(GTK_CONTAINER(splashscreen.splash), vbox);
     gtk_widget_show(vbox);

     // Set the Text Label
     splashscreen.text = gtk_label_new(_("Starting Group File Manager..."));
     gtk_box_pack_end(GTK_BOX(vbox), splashscreen.text, FALSE, FALSE, 0);
     gtk_widget_show(splashscreen.text);

     // Set the Version
     version_string = g_strconcat("Version ", GFM_VERSION, NULL);
     ver_lbl = gtk_label_new(version_string);
     gtk_box_pack_end(GTK_BOX(vbox), ver_lbl, FALSE, FALSE, 0);
     gtk_widget_show(ver_lbl);
     g_free(version_string);

     // Setup the Splash Logo
     pixbuf = create_pixbuf("gfm.xpm");
     image = gtk_image_new_from_pixbuf(pixbuf);
     gtk_box_pack_end(GTK_BOX(vbox), image, FALSE, FALSE, 0);
     g_object_unref(pixbuf);

     // Lets show the Splash Screen now
     gtk_widget_show(image);
     gtk_widget_show(splashscreen.splash);

     // Lets Make sure this works
     GTK_REFRESH(); // Defintion in support.h

     // Ok, done
     splashscreen.enabled = 1;
     return;
}
Exemplo n.º 6
0
void C4DevmodeDlg::AddPage(GtkWidget* widget, GtkWindow* parent, const char* title)
{
	// Create Window if necessary
	if (window == NULL)
	{
		notebook = gtk_notebook_new();
		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), false);
		gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook), false);
		gtk_widget_show(GTK_WIDGET(notebook));

		window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
		gtk_container_add(GTK_CONTAINER(window), notebook);

		gtk_window_set_resizable(GTK_WINDOW(window), true);
		gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_UTILITY);
		gtk_window_set_default_size(GTK_WINDOW(window), 320, 320);
		gtk_window_set_role(GTK_WINDOW(window), "toolbox");

		gtk_window_set_transient_for(GTK_WINDOW(window), parent);
		gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER_ON_PARENT);

		g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(OnDeleteEvent), NULL);
		g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(OnDestroy), NULL);
	}

	// Add page to notebook
	GtkWidget* label = gtk_label_new(title);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), widget, label);
}
Exemplo n.º 7
0
GtkWidget *window_new(GtkWindowType type, const gchar *role, const gchar *icon,
		      const gchar *icon_file, const gchar *subtitle)
{
	gchar *title;
	GtkWidget *window;

	window = gtk_window_new(type);
	if (!window) return NULL;

	if (subtitle)
		{
		title = g_strdup_printf("%s - %s", subtitle, GQ_APPNAME);
		}
	else
		{
		title = g_strdup_printf("%s", GQ_APPNAME);
		}

	gtk_window_set_title(GTK_WINDOW(window), title);
	g_free(title);

	window_set_icon(window, icon, icon_file);
	gtk_window_set_role(GTK_WINDOW(window), role);

	return window;
}
Exemplo n.º 8
0
/**
 * Create toolbox component for distributed user interface 
 */
void
create_toolbox ()
{
  GtkWidget *window;
  GtkWidget *main_vbox;
  GtkWidget *wrapbox;
  GtkWidget *menubar;
  GtkAccelGroup *accel_group;

#ifdef HAVE_GNOME
  window = gnome_app_new ("Dia", _("Diagram Editor"));
#else
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_object_ref(window);
  gtk_window_set_title (GTK_WINDOW (window), "Dia v" VERSION);
#endif
  gtk_window_set_role (GTK_WINDOW (window), "toolbox_window");
  gtk_window_set_default_size(GTK_WINDOW(window), 146, 349);

  app_set_icon (GTK_WINDOW (window));

  g_signal_connect (G_OBJECT (window), "delete_event",
		    G_CALLBACK (toolbox_delete), window);
  g_signal_connect (G_OBJECT (window), "destroy",
		    G_CALLBACK (toolbox_destroy), window);

  main_vbox = gtk_vbox_new (FALSE, 1);
  gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 1);
#ifdef HAVE_GNOME
  gnome_app_set_contents(GNOME_APP(window), main_vbox);
#else
  gtk_container_add (GTK_CONTAINER (window), main_vbox);
#endif

  wrapbox = toolbox_create();
  gtk_box_pack_end (GTK_BOX (main_vbox), wrapbox, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (wrapbox), "drag_data_received",
		    G_CALLBACK (dia_dnd_file_drag_data_received),
                    NULL); /* userdata == NULL here intentionally */
  gtk_widget_show (main_vbox);

  /* menus -- initialised afterwards, because initing the display menus
   * uses the tool buttons*/
  menus_get_toolbox_menubar(&menubar, &accel_group);
  gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
#ifdef HAVE_GNOME
  gnome_app_set_menus(GNOME_APP(window), GTK_MENU_BAR(menubar));
#else
#  ifdef HAVE_MAC_INTEGRATION
  _create_mac_integration ();
#  else
  gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
  gtk_widget_show (menubar);
#  endif
#endif
  persistence_register_window(GTK_WINDOW(window));

  toolbox_shell = window;
}
Exemplo n.º 9
0
/**
 * gedit_app_create_window:
 * @app: the #GeditApp
 * @screen: (allow-none):
 *
 * Create a new #GeditWindow part of @app.
 *
 * Return value: (transfer none): the new #GeditWindow
 */
GeditWindow *
gedit_app_create_window (GeditApp  *app,
			 GdkScreen *screen)
{
	GeditAppPrivate *priv;
	GeditWindow *window;
	gchar *role;
	GdkWindowState state;
	gint w, h;

	gedit_debug (DEBUG_APP);

	priv = gedit_app_get_instance_private (app);

	window = GEDIT_APP_GET_CLASS (app)->create_window (app);

	if (screen != NULL)
	{
		gtk_window_set_screen (GTK_WINDOW (window), screen);
	}

	role = gen_role ();
	gtk_window_set_role (GTK_WINDOW (window), role);
	g_free (role);

	state = g_settings_get_int (priv->window_settings,
	                            GEDIT_SETTINGS_WINDOW_STATE);

	g_settings_get (priv->window_settings,
	                GEDIT_SETTINGS_WINDOW_SIZE,
	                "(ii)", &w, &h);

	gtk_window_set_default_size (GTK_WINDOW (window), w, h);

	if ((state & GDK_WINDOW_STATE_MAXIMIZED) != 0)
	{
		gtk_window_maximize (GTK_WINDOW (window));
	}
	else
	{
		gtk_window_unmaximize (GTK_WINDOW (window));
	}

	if ((state & GDK_WINDOW_STATE_STICKY ) != 0)
	{
		gtk_window_stick (GTK_WINDOW (window));
	}
	else
	{
		gtk_window_unstick (GTK_WINDOW (window));
	}

	return window;
}
Exemplo n.º 10
0
/*!
 * Create a new GtkDialog
 */
GtkWidget * abiDialogNew(const char * role, gboolean resizable)
{
  GtkWidget * dlg = gtk_dialog_new () ;
  if ( role )
    gtk_window_set_role ( GTK_WINDOW(dlg), role ) ;
  gtk_window_set_resizable ( GTK_WINDOW(dlg), resizable ) ;
  gtk_dialog_set_has_separator ( GTK_DIALOG (dlg), false ) ;
  gtk_container_set_border_width ( GTK_CONTAINER (dlg), 5 ) ;
  gtk_box_set_spacing ( GTK_BOX ( GTK_DIALOG (dlg)->vbox), 2 ) ;
  return dlg ;
}
Exemplo n.º 11
0
static void
math_window_init(MathWindow *window)
{
    window->priv = G_TYPE_INSTANCE_GET_PRIVATE(window, math_window_get_type(), MathWindowPrivate);
    gtk_window_set_title(GTK_WINDOW(window),
                         /* Title of main window */
                         _("Calculator"));
    gtk_window_set_role(GTK_WINDOW(window), "mate-calc");
    gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
    g_signal_connect_after(G_OBJECT(window), "key-press-event", G_CALLBACK(key_press_cb), NULL);
    g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(delete_cb), NULL);
}
Exemplo n.º 12
0
void
text_tool_load_cmd_callback (GtkAction *action,
                             gpointer   data)
{
  GimpTextTool *text_tool = GIMP_TEXT_TOOL (data);
  GtkWidget    *dialog;

  dialog = dialogs_get_dialog (G_OBJECT (text_tool), "gimp-text-file-dialog");

  if (! dialog)
    {
      GtkWidget *parent = NULL;

      if (GIMP_TOOL (text_tool)->display)
        {
          GimpDisplayShell *shell;

          shell = gimp_display_get_shell (GIMP_TOOL (text_tool)->display);

          parent = gtk_widget_get_toplevel (GTK_WIDGET (shell));
        }

      dialog = gtk_file_chooser_dialog_new (_("Open Text File (UTF-8)"),
                                            parent ? GTK_WINDOW (parent) : NULL,
                                            GTK_FILE_CHOOSER_ACTION_OPEN,

                                            _("_Cancel"), GTK_RESPONSE_CANCEL,
                                            _("_Open"),   GTK_RESPONSE_OK,

                                            NULL);

      gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
      gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                               GTK_RESPONSE_OK,
                                               GTK_RESPONSE_CANCEL,
                                               -1);

      gtk_window_set_role (GTK_WINDOW (dialog), "gimp-text-load-file");
      gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);

      g_signal_connect (dialog, "response",
                        G_CALLBACK (text_tool_load_dialog_response),
                        text_tool);
      g_signal_connect (dialog, "delete-event",
                        G_CALLBACK (gtk_true),
                        NULL);

      dialogs_attach_dialog (G_OBJECT (text_tool),
                             "gimp-text-file-dialog", dialog);
    }

  gtk_window_present (GTK_WINDOW (dialog));
}
Exemplo n.º 13
0
void
pragha_init_session_support(PraghaApplication *pragha)
{
    GtkWidget *window;
    gchar *role;

    window = pragha_application_get_window (pragha);

    /* set a unique role on each window (for session management) */
    role = g_strdup_printf ("Pragha-%p-%d-%d", window, (gint) getpid (), (gint) time (NULL));
    gtk_window_set_role (GTK_WINDOW (window), role);
    g_free (role);
}
Exemplo n.º 14
0
static GObject *
gimp_profile_chooser_dialog_constructor (GType                  type,
                                         guint                  n_params,
                                         GObjectConstructParam *params)
{
  GObject                  *object;
  GimpProfileChooserDialog *dialog;
  GtkFileFilter            *filter;

  object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);

  dialog = GIMP_PROFILE_CHOOSER_DIALOG (object);

  gtk_window_set_role (GTK_WINDOW (dialog), "gimp-profile-chooser-dialog");

  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
                          GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                          GTK_STOCK_OPEN,   GTK_RESPONSE_ACCEPT,
                          NULL);

  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                           GTK_RESPONSE_ACCEPT,
                                           GTK_RESPONSE_CANCEL,
                                           -1);

  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);

  gimp_profile_chooser_dialog_add_shortcut (dialog);

  filter = gtk_file_filter_new ();
  gtk_file_filter_set_name (filter, _("All files (*.*)"));
  gtk_file_filter_add_pattern (filter, "*");
  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);

  filter = gtk_file_filter_new ();
  gtk_file_filter_set_name (filter, _("ICC color profile (*.icc, *.icm)"));
  gtk_file_filter_add_pattern (filter, "*.[Ii][Cc][Cc]");
  gtk_file_filter_add_pattern (filter, "*.[Ii][Cc][Mm]");
  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);

  gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);

  gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (dialog),
                                       gimp_profile_view_new (dialog->buffer));

  g_signal_connect (dialog, "update-preview",
                    G_CALLBACK (gimp_profile_chooser_dialog_update_preview),
                    NULL);

  return object;
}
Exemplo n.º 15
0
/*!
 * This is a small message box for startup warnings and/or
 * errors.  Please do NOT use this for normal system execution
 * user messages; use the XAP_UnixDialog_MessageBox class for that.
 * We can't use that here because there is no parent frame, etc.
 */
void messageBoxOK(const char * message)
{
	GtkWidget * msg = gtk_message_dialog_new ( NULL,
						   GTK_DIALOG_MODAL,
						   GTK_MESSAGE_INFO,
						   GTK_BUTTONS_OK,
						   message ) ;

	gtk_window_set_title(GTK_WINDOW(msg), "AbiWord");
	gtk_window_set_role(GTK_WINDOW(msg), "message dialog");

	gtk_widget_show ( msg ) ;
	gtk_dialog_run ( GTK_DIALOG(msg) ) ;
	gtk_widget_destroy ( msg ) ;
}
Exemplo n.º 16
0
static void
linewidth_create_dialog()
{
  GtkWidget *hbox;
  GtkWidget *label;
  GtkAdjustment *adj;

  linewidth_dialog = gtk_dialog_new_with_buttons(
	_("Line width"), GTK_WINDOW(interface_get_toolbox_shell()),
	0,
	GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
	GTK_STOCK_OK, GTK_RESPONSE_OK, 
	NULL);
  
  gtk_dialog_set_default_response (GTK_DIALOG(linewidth_dialog), GTK_RESPONSE_OK);
  gtk_window_set_role (GTK_WINDOW (linewidth_dialog), "linewidth_window");
  gtk_window_set_resizable (GTK_WINDOW (linewidth_dialog), TRUE);
  gtk_container_set_border_width (GTK_CONTAINER (linewidth_dialog), 2);

  hbox = gtk_hbox_new(FALSE, 5);
  label = gtk_label_new(_("Line width:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
  gtk_widget_show (label);
  adj = (GtkAdjustment *) gtk_adjustment_new(0.1, 0.00, 10.0, 0.01, 0.05, 0.0);
  linewidth_button = gtk_spin_button_new(adj, attributes_get_default_linewidth(), 2);
  gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(linewidth_button), TRUE);
  gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(linewidth_button), TRUE);
  gtk_box_pack_start(GTK_BOX (hbox), linewidth_button, TRUE, TRUE, 0);
  gtk_widget_show (linewidth_button);
  gtk_widget_show(hbox);
  gtk_box_pack_start (GTK_BOX(GTK_DIALOG (linewidth_dialog)->vbox), hbox, TRUE, TRUE, 0);
  
  gtk_widget_show (linewidth_button);

  g_signal_connect(G_OBJECT (linewidth_dialog), "response",
                   G_CALLBACK (linewidth_dialog_respond), NULL);
  g_signal_connect_after(G_OBJECT (linewidth_button), "activate",
                   G_CALLBACK (linewidth_dialog_ok), NULL);

  g_signal_connect (GTK_OBJECT (linewidth_dialog), "delete_event",
		    G_CALLBACK(gtk_widget_hide), NULL);
  g_signal_connect (GTK_OBJECT (linewidth_dialog), "destroy",
		    G_CALLBACK(dialog_destroyed), &linewidth_dialog);

  persistence_register_window (GTK_WINDOW (linewidth_dialog));
}
Exemplo n.º 17
0
/* show a transient message dialog */
static void
metadata_message_dialog (GtkMessageType  type,
                         GtkWindow      *parent,
                         const gchar    *title,
                         const gchar    *message)
{
  GtkWidget *dlg;

  dlg = gtk_message_dialog_new (parent, 0, type, GTK_BUTTONS_OK, "%s", message);

  if (title)
    gtk_window_set_title (GTK_WINDOW (dlg), title);

  gtk_window_set_role (GTK_WINDOW (dlg), "metadata-message");
  gtk_dialog_run (GTK_DIALOG (dlg));
  gtk_widget_destroy (dlg);
}
Exemplo n.º 18
0
static void
gwy_tool_init(GwyTool *tool,
              gpointer g_class)
{
    GwyToolClass *klass;
    GtkWindow *window;
    gint width, height;

    klass = GWY_TOOL_CLASS(g_class);
    gwy_debug("%s", klass->title);
    tool->dialog = gtk_dialog_new();
    gtk_dialog_set_has_separator(GTK_DIALOG(tool->dialog), FALSE);

    window = GTK_WINDOW(tool->dialog);
    gtk_window_set_title(window, gettext(klass->title));
    gwy_app_add_main_accel_group(window);
    /* Prevent too smart window managers from making big mistakes */
    gtk_window_set_position(window, GTK_WIN_POS_NONE);
    gtk_window_set_type_hint(window, GDK_WINDOW_TYPE_HINT_NORMAL);
    gtk_window_set_role(window, "tool");

    /* Set the default window size first from class,
     * then let settings override it */
    width = klass->default_width > 0 ? klass->default_width : -1;
    height = klass->default_height > 0 ? klass->default_height : -1;
    gtk_window_set_default_size(window, width, height);
    if (klass->prefix && g_str_has_prefix(klass->prefix, "/module")) {
        gchar *key;
        guint len;

        len = strlen(klass->prefix);
        key = g_newa(gchar, len + sizeof("/dialog"));
        strcpy(key, klass->prefix);
        strcpy(key + len, "/dialog");
        gwy_app_restore_window_position(GTK_WINDOW(tool->dialog), key, TRUE);
    }

    g_signal_connect_swapped(tool->dialog, "unmap",
                             G_CALLBACK(gwy_tool_unmap), tool);
    g_signal_connect(tool->dialog, "delete-event",
                     G_CALLBACK(gwy_dialog_prevent_delete_cb), NULL);
    g_signal_connect_swapped(tool->dialog, "response",
                             G_CALLBACK(gwy_tool_response), tool);
}
Exemplo n.º 19
0
void
app_splash_init (const gchar* fname)
{
  GtkWidget *vbox;
  GtkWidget* gpixmap;
  GtkWidget *label;
  GtkWidget *frame;
  gchar str[256];
  gulong signal_id;

  splash = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_role (GTK_WINDOW (splash), "start_dialog");
  gtk_window_set_title (GTK_WINDOW (splash), _("Loading \342\200\246"));
  gtk_window_set_resizable (GTK_WINDOW (splash), FALSE);
  gtk_window_set_position (GTK_WINDOW (splash), GTK_WIN_POS_CENTER);

  vbox = gtk_vbox_new (FALSE, 2);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
  gtk_container_add (GTK_CONTAINER(splash), vbox);

  gpixmap = get_logo_pixmap();

  frame = gtk_frame_new (NULL);
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
  gtk_container_set_border_width (GTK_CONTAINER (frame), 1);
  gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 1);

  if (gpixmap)
    gtk_container_add (GTK_CONTAINER(frame), gpixmap);

  g_snprintf(str, sizeof(str), _("Dia v %s"), VERSION);
  label = gtk_label_new (str);
  gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 1);

  gtk_widget_show_all (splash);

  signal_id = g_signal_connect_after(G_OBJECT(splash), "expose_event",
				     G_CALLBACK(splash_expose), NULL);

  /* splash_expose gets us out of this */
  gtk_main();
  g_signal_handler_disconnect(G_OBJECT(splash), signal_id);
}
Exemplo n.º 20
0
/* should eventually go to it's own file, just for testing 
 * The DiagramTreeView should remain integrateable with the integrated UI.
 */
void
diagram_tree_show (void)
{
  static GtkWidget *window = NULL;

  if (!window) {
    GtkWidget *sw;
    GtkWidget *dtv;

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), _("Diagram Tree"));

    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_AUTOMATIC);
    gtk_container_add (GTK_CONTAINER (window), sw);
    gtk_window_set_default_size (GTK_WINDOW (window), 300, 600);

    dtv = diagram_tree_view_new ();
    gtk_container_add (GTK_CONTAINER (sw), dtv);
    /* expand all rows after the treeview widget has been realized */
    g_signal_connect (dtv, "realize",
		      G_CALLBACK (gtk_tree_view_expand_all), NULL);
    g_signal_connect (G_OBJECT (window), "destroy",
		      G_CALLBACK (gtk_widget_destroyed),
		      &window);

    gtk_window_set_role (GTK_WINDOW (window), "diagram_tree");

#if GTK_CHECK_VERSION(2,20,0)
    if (!gtk_widget_get_visible (window))
#else
    if (!GTK_WIDGET_VISIBLE (window))
#endif
      gtk_widget_show_all (window);

    /* FIXME: remove flicker by removing gtk_widget_show from persistence_register_window() */
    persistence_register_window (GTK_WINDOW (window));
  }
  gtk_window_present (GTK_WINDOW(window));
}
Exemplo n.º 21
0
Thtml_diag *html_diag_new(Tbfwin *bfwin, gchar *title) {
	Thtml_diag *dg;
	
	dg = g_malloc(sizeof(Thtml_diag));
	/* kyanh, removed, 20050225,
	dg->tobedestroyed = FALSE;
	*/
	DEBUG_MSG("html_diag_new, dg=%p\n",dg);
	dg->dialog = window_full2(title, GTK_WIN_POS_MOUSE, 12,G_CALLBACK(html_diag_destroy_cb), dg, TRUE/* escape key close the winow */,  bfwin ? bfwin->main_window : NULL);
	gtk_window_set_type_hint(GTK_WINDOW(dg->dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
	gtk_window_set_role(GTK_WINDOW(dg->dialog), "html_dialog");
	dg->vbox = gtk_vbox_new(FALSE, 1);
	gtk_container_add(GTK_CONTAINER(dg->dialog), dg->vbox);
	{
		if (!gtk_text_buffer_get_mark(bfwin->current_document->buffer,"diag_ins")) {
			GtkTextIter iter;
			GtkTextMark* mark = gtk_text_buffer_get_mark(bfwin->current_document->buffer,"insert");
			gtk_text_buffer_get_iter_at_mark(bfwin->current_document->buffer,&iter,mark);
			dg->mark_ins = gtk_text_buffer_create_mark(bfwin->current_document->buffer,"diag_ins",&iter,TRUE);
			mark = gtk_text_buffer_get_mark(bfwin->current_document->buffer,"selection_bound");
			gtk_text_buffer_get_iter_at_mark(bfwin->current_document->buffer,&iter,mark);
			dg->mark_sel = gtk_text_buffer_create_mark(bfwin->current_document->buffer,"diag_sel",&iter,TRUE);
		} else {
			dg->mark_ins = dg->mark_sel = NULL;
		}
	}
/*	
	dg->range.pos = -1;
	dg->range.end = -1;
*/

	if (main_v->props.view_bars & MODE_MAKE_LATEX_TRANSIENT) {
		/* must be set before realizing */
		DEBUG_MSG("html_diag_finish, setting dg->dialog=%p transient!\n", dg->dialog);
		gtk_window_set_transient_for(GTK_WINDOW(dg->dialog), GTK_WINDOW(bfwin->main_window));
	}
	gtk_widget_realize(dg->dialog);
	dg->bfwin = bfwin;
	dg->doc = bfwin->current_document;
	return dg;
}
Exemplo n.º 22
0
static void create_dialog()
{
/*   GtkWidget *actionbox; */
/*   GList *buttons; */

  dialog = gtk_dialog_new_with_buttons(
             _("Object properties"),
             GTK_WINDOW (ddisplay_active()->shell), 
             GTK_DIALOG_DESTROY_WITH_PARENT,
             GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
             GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
             GTK_STOCK_OK, GTK_RESPONSE_OK,
             NULL);

  gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_OK);

  dialog_vbox = GTK_DIALOG(dialog)->vbox;

  gtk_window_set_role(GTK_WINDOW (dialog), "properties_window");

  g_signal_connect(G_OBJECT (dialog), "response",
                   G_CALLBACK (properties_respond), NULL);
  g_signal_connect(G_OBJECT (dialog), "delete_event",
		   G_CALLBACK(properties_dialog_hide), NULL);
  g_signal_connect(G_OBJECT (dialog), "destroy",
		   G_CALLBACK(gtk_widget_destroyed), &dialog);
  g_signal_connect(G_OBJECT (dialog), "destroy",
		   G_CALLBACK(gtk_widget_destroyed), &dialog_vbox);
  g_signal_connect(G_OBJECT (dialog), "key-release-event",
		   G_CALLBACK(properties_key_event), NULL);

  no_properties_dialog = gtk_label_new(_("This object has no properties."));
  gtk_widget_show (no_properties_dialog);
#if GLIB_CHECK_VERSION(2,10,0)
  g_object_ref_sink (G_OBJECT (no_properties_dialog));
#else
  g_object_ref (G_OBJECT (no_properties_dialog));
  gtk_object_sink (GTK_OBJECT (no_properties_dialog));
#endif
}
extern "C" const char *Init( int *argc, char ***argv )
{
	// Need to use external library to load this image. Native loader seems broken :/
	const gchar *splash_image_path = "Data/splash.png";
	GtkWidget *vbox;

	gtk_disable_setlocale();
	if( !gtk_init_check(argc,argv) )
		return "Couldn't initialize gtk (cannot open display)";

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_position( GTK_WINDOW(window), GTK_WIN_POS_CENTER );
	gtk_widget_set_size_request(window,468,-1);
	gtk_window_set_deletable( GTK_WINDOW(window), FALSE );
	gtk_window_set_resizable(GTK_WINDOW(window),FALSE);
	gtk_window_set_role( GTK_WINDOW(window), "sm-startup" );
	//gtk_window_set_icon( GTK_WINDOW(window), );
	gtk_widget_realize(window);

	splash = gtk_image_new_from_file(splash_image_path);

	label = gtk_label_new(NULL);
	gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_CENTER);
	gtk_label_set_ellipsize(GTK_LABEL(label),PANGO_ELLIPSIZE_END);
	gtk_label_set_line_wrap(GTK_LABEL(label),FALSE);

	progressBar = gtk_progress_bar_new();
	gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(progressBar), 0.0 );

	vbox = gtk_vbox_new(FALSE,0);
	gtk_container_add(GTK_CONTAINER(window),vbox);
	gtk_box_pack_start(GTK_BOX(vbox),splash,FALSE,FALSE,0);
	gtk_box_pack_end(GTK_BOX(vbox),progressBar,FALSE,FALSE,0);
	gtk_box_pack_end(GTK_BOX(vbox),label,TRUE,TRUE,0);

	gtk_widget_show_all(window);
	gtk_main_iteration_do(FALSE);
	return NULL;
}
Exemplo n.º 24
0
static void
window_added_cb (GtkApplication *application,
		 GtkWindow *window,
		 EphySession *session)
{
	GtkWidget *notebook;
	EphyWindow *ephy_window;

	ephy_session_save (session, SESSION_STATE);

	if (!EPHY_IS_WINDOW (window))
		return;

	ephy_window = EPHY_WINDOW (window);

	notebook = ephy_window_get_notebook (ephy_window);
	g_signal_connect (notebook, "page-added",
			  G_CALLBACK (notebook_page_added_cb), session);
	g_signal_connect (notebook, "page-removed",
			  G_CALLBACK (notebook_page_removed_cb), session);
	g_signal_connect (notebook, "page-reordered",
			  G_CALLBACK (notebook_page_reordered_cb), session);

	/* Set unique identifier as role, so that on restore, the WM can
	 * place the window on the right workspace
	 */

	if (gtk_window_get_role (window) == NULL)
	{
		/* I guess rand() is unique enough, otherwise we could use
		 * time + pid or something
		 */
		char *role;

		role = g_strdup_printf ("epiphany-window-%x", rand());
		gtk_window_set_role (window, role);
		g_free (role);
	}
}
Exemplo n.º 25
0
static void
impl_attach_window (EphyExtension *extension,
		    EphyWindow *window)
{
	EphySession *session = EPHY_SESSION (extension);
	GtkWidget *notebook;

	LOG ("impl_attach_window");

	session->priv->windows = g_list_append (session->priv->windows, window);
	ephy_session_save (session, SESSION_STATE);

	g_signal_connect (window, "focus-in-event",
			  G_CALLBACK (window_focus_in_event_cb), session);

	notebook = ephy_window_get_notebook (window);
	g_signal_connect (notebook, "page-added",
			  G_CALLBACK (notebook_page_added_cb), session);
	g_signal_connect (notebook, "page-removed",
			  G_CALLBACK (notebook_page_removed_cb), session);
	g_signal_connect (notebook, "page-reordered",
			  G_CALLBACK (notebook_page_reordered_cb), session);

	/* Set unique identifier as role, so that on restore, the WM can
	 * place the window on the right workspace
	 */

	if (gtk_window_get_role (GTK_WINDOW (window)) == NULL)
	{
		/* I guess rand() is unique enough, otherwise we could use
		 * time + pid or something
		 */
		char *role;

		role = g_strdup_printf ("epiphany-window-%x", rand());
		gtk_window_set_role (GTK_WINDOW (window), role);
		g_free (role);
	}
}
Exemplo n.º 26
0
GtkWidget *
gtkutil_window_new (char *title, char *role, int width, int height, int flags)
{
	GtkWidget *win;

	win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtkutil_set_icon (win);
#ifdef WIN32
	gtk_window_set_wmclass (GTK_WINDOW (win), "XChat", "xchat");
#endif
	gtk_window_set_title (GTK_WINDOW (win), title);
	gtk_window_set_default_size (GTK_WINDOW (win), width, height);
	gtk_window_set_role (GTK_WINDOW (win), role);
	if (flags & 1)
		gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_MOUSE);
	if ((flags & 2) && parent_window)
	{
		gtk_window_set_type_hint (GTK_WINDOW (win), GDK_WINDOW_TYPE_HINT_DIALOG);
		gtk_window_set_transient_for (GTK_WINDOW (win), GTK_WINDOW (parent_window));
	}

	return win;
}
Exemplo n.º 27
0
static void
gimp_error_dialog_init (GimpErrorDialog *dialog)
{
  gtk_window_set_role (GTK_WINDOW (dialog), "gimp-message");

  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
                          GTK_STOCK_OK, GTK_RESPONSE_CLOSE,
                          NULL);

  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);

  gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);

  dialog->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
                      dialog->vbox, TRUE, TRUE, 0);
  gtk_widget_show (dialog->vbox);

  dialog->last_box     = NULL;
  dialog->last_domain  = NULL;
  dialog->last_message = NULL;
  dialog->num_messages = 0;
}
static void
shell_show_overview_page (CinnamonControlCenter *center)
{
  CinnamonControlCenterPrivate *priv = center->priv;

  notebook_select_page (priv->notebook, priv->scrolled_window);

  if (priv->current_panel_box)
    notebook_remove_page (priv->notebook, priv->current_panel_box);
  priv->current_panel = NULL;
  priv->current_panel_box = NULL;

  if (priv->current_panel_id) {
    g_free (priv->current_panel_id);
    priv->current_panel_id = NULL;
  }

  /* clear the search text */
  g_free (priv->filter_string);
  priv->filter_string = g_strdup ("");

  gtk_lock_button_set_permission (GTK_LOCK_BUTTON (priv->lock_button), NULL);

  /* reset window title and icon */
  gtk_window_set_role (GTK_WINDOW (priv->window), NULL);
  gtk_window_set_title (GTK_WINDOW (priv->window), priv->default_window_title);
  gtk_window_set_default_icon_name (priv->default_window_icon);
  gtk_window_set_icon_name (GTK_WINDOW (priv->window),
                            priv->default_window_icon);

  cc_shell_set_active_panel (CC_SHELL (center), NULL);

  /* clear any custom widgets */
  _shell_remove_all_custom_widgets (priv);

  cc_shell_nav_bar_hide_detail_button (CC_SHELL_NAV_BAR (priv->nav_bar));
}
Exemplo n.º 29
0
static void
create_dialog(GtkWidget *parent)
{
/*   GtkWidget *actionbox; */
/*   GList *buttons; */

  dialog = gtk_dialog_new_with_buttons(
             _("Object properties"),
             parent ? GTK_WINDOW (parent) : NULL,
             GTK_DIALOG_DESTROY_WITH_PARENT,
             GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
             GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
             GTK_STOCK_OK, GTK_RESPONSE_OK,
             NULL);

  gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_OK);

  dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG(dialog));

  gtk_window_set_role(GTK_WINDOW (dialog), "properties_window");

  g_signal_connect(G_OBJECT (dialog), "response",
                   G_CALLBACK (properties_respond), NULL);
  g_signal_connect(G_OBJECT (dialog), "delete_event",
		   G_CALLBACK(properties_dialog_hide), NULL);
  g_signal_connect(G_OBJECT (dialog), "destroy",
		   G_CALLBACK(gtk_widget_destroyed), &dialog);
  g_signal_connect(G_OBJECT (dialog), "destroy",
		   G_CALLBACK(gtk_widget_destroyed), &dialog_vbox);
  g_signal_connect(G_OBJECT (dialog), "key-release-event",
		   G_CALLBACK(properties_key_event), NULL);

  no_properties_dialog = gtk_label_new(_("This object has no properties."));
  gtk_widget_show (no_properties_dialog);
  g_object_ref_sink (G_OBJECT (no_properties_dialog));
}
Exemplo n.º 30
0
static gboolean
terminal_factory_impl_create_instance (TerminalFactory *factory,
                                       GDBusMethodInvocation *invocation,
                                       GVariant *options)
{
  TerminalApp *app = terminal_app_get ();
  TerminalSettingsList *profiles_list;
  GDBusObjectManagerServer *object_manager;
  TerminalWindow *window;
  TerminalScreen *screen;
  TerminalReceiverImpl *impl;
  TerminalObjectSkeleton *skeleton;
  char *object_path;
  GSettings *profile = NULL;
  const char *profile_uuid, *title, *encoding;
  gboolean zoom_set = FALSE;
  gdouble zoom = 1.0;
  guint window_id;
  gboolean show_menubar;
  gboolean active;
  gboolean have_new_window, present_window, present_window_set;
  GError *err = NULL;

  /* Look up the profile */
  if (!g_variant_lookup (options, "profile", "&s", &profile_uuid))
    profile_uuid = NULL;

  if (!g_variant_lookup (options, "encoding", "&s", &encoding))
    encoding = NULL; /* use profile encoding */

  profiles_list = terminal_app_get_profiles_list (app);
  profile = terminal_profiles_list_ref_profile_by_uuid (profiles_list, profile_uuid, &err);
  if (profile == NULL)
    {
      g_dbus_method_invocation_return_gerror (invocation, err);
      g_error_free (err);
      goto out;
    }

  if (g_variant_lookup (options, "window-id", "u", &window_id)) {
    GtkWindow *win;

    win = gtk_application_get_window_by_id (GTK_APPLICATION (app), window_id);

    if (!TERMINAL_IS_WINDOW (win)) {
      g_dbus_method_invocation_return_error (invocation,
                                             G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
                                             "Nonexisting window %u referenced",
                                             window_id);
      goto out;
    }

    window = TERMINAL_WINDOW (win);
    have_new_window = FALSE;
  } else {
    const char *startup_id, *display_name, *role;
    gboolean start_maximized, start_fullscreen;
    int screen_number;
    GdkScreen *gdk_screen;

    /* Create a new window */

    if (!g_variant_lookup (options, "display", "^&ay", &display_name)) {
      g_dbus_method_invocation_return_error_literal (invocation, 
                                                     G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
                                                     "No display specified");
      goto out;
    }

    screen_number = 0;
    gdk_screen = terminal_util_get_screen_by_display_name (display_name, screen_number);
    if (gdk_screen == NULL) {
      g_dbus_method_invocation_return_error (invocation, 
                                             G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
                                             "No screen %d on display \"%s\"",
                                             screen_number, display_name);
      goto out;
    }

    window = terminal_app_new_window (app, gdk_screen);

    if (g_variant_lookup (options, "desktop-startup-id", "^&ay", &startup_id))
      gtk_window_set_startup_id (GTK_WINDOW (window), startup_id);

    /* Overwrite the default, unique window role set in terminal_window_init */
    if (g_variant_lookup (options, "role", "&s", &role))
      gtk_window_set_role (GTK_WINDOW (window), role);

    if (g_variant_lookup (options, "show-menubar", "b", &show_menubar))
      terminal_window_set_menubar_visible (window, show_menubar);

    if (g_variant_lookup (options, "fullscreen-window", "b", &start_fullscreen) &&
        start_fullscreen) {
      gtk_window_fullscreen (GTK_WINDOW (window));
    }
    if (g_variant_lookup (options, "maximize-window", "b", &start_maximized) &&
        start_maximized) {
      gtk_window_maximize (GTK_WINDOW (window));
    }

    have_new_window = TRUE;
  }

  g_assert (window != NULL);

  if (!g_variant_lookup (options, "title", "&s", &title))
    title = NULL;
  if (g_variant_lookup (options, "zoom", "d", &zoom))
    zoom_set = TRUE;

  screen = terminal_screen_new (profile, encoding, NULL, title, NULL, NULL,
                                zoom_set ? zoom : 1.0);
  terminal_window_add_screen (window, screen, -1);

  object_path = get_object_path_for_screen (window, screen);
  g_assert (g_variant_is_object_path (object_path));

  skeleton = terminal_object_skeleton_new (object_path);
  impl = terminal_receiver_impl_new (screen);
  terminal_object_skeleton_set_receiver (skeleton, TERMINAL_RECEIVER (impl));
  g_object_unref (impl);

  object_manager = terminal_app_get_object_manager (app);
  g_dbus_object_manager_server_export (object_manager, G_DBUS_OBJECT_SKELETON (skeleton));
  g_object_set_data_full (G_OBJECT (screen), RECEIVER_IMPL_SKELETON_DATA_KEY,
                          skeleton, (GDestroyNotify) g_object_unref);
  g_signal_connect (screen, "destroy",
                    G_CALLBACK (screen_destroy_cb), app);

  if (g_variant_lookup (options, "active", "b", &active) &&
      active) {
    terminal_window_switch_screen (window, screen);
    gtk_widget_grab_focus (GTK_WIDGET (screen));
  }

  if (g_variant_lookup (options, "present-window", "b", &present_window))
    present_window_set = TRUE;
  else
    present_window_set = FALSE;

  if (have_new_window) {
    const char *geometry;

    if (g_variant_lookup (options, "geometry", "&s", &geometry) &&
        !terminal_window_parse_geometry (window, geometry))
      _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
                             "Invalid geometry string \"%s\"", geometry);
  }

  if (have_new_window || (present_window_set && present_window))
    gtk_window_present (GTK_WINDOW (window));

  terminal_factory_complete_create_instance (factory, invocation, object_path);

  g_free (object_path);

out:
  if (profile)
    g_object_unref (profile);

  return TRUE; /* handled */
}