Esempio n. 1
0
File: main.c Progetto: lcp/bisho
static UniqueResponse
unique_message_cb (UniqueApp *app,
                   UniqueCommand  command,
                   UniqueMessageData *message,
                   guint time_, gpointer user_data)
{
  GtkWindow *window = GTK_WINDOW (user_data);
  char **uris;

  switch (command) {
  case UNIQUE_ACTIVATE:
    gtk_window_set_screen (window, unique_message_data_get_screen (message));
    gtk_window_present_with_time (window, time_);
    break;
  case COMMAND_CALLBACK:
    gtk_window_set_screen (window, unique_message_data_get_screen (message));
    gtk_window_present_with_time (window, time_);

    uris = unique_message_data_get_uris (message);
    if (uris)
      handle_uri (BISHO_WINDOW (window), uris[0]);
    g_strfreev (uris);
    break;
  default:
    break;
  }

  return UNIQUE_RESPONSE_OK;
}
/* Menu Callback : Destroy all sticky notes */
void menu_destroy_all_cb(GtkAction *action, StickyNotesApplet *applet)
{
	GtkBuilder *builder;

	builder = gtk_builder_new ();
  	gtk_builder_add_from_file (builder, BUILDER_PATH, NULL);

	if (applet->destroy_all_dialog != NULL) {
		gtk_window_set_screen (GTK_WINDOW (applet->destroy_all_dialog),
				       gtk_widget_get_screen (GTK_WIDGET (applet->w_applet)));

		gtk_window_present (GTK_WINDOW (applet->destroy_all_dialog));
		return;
	}

	applet->destroy_all_dialog = GTK_WIDGET (gtk_builder_get_object (builder, "delete_all_dialog"));

	g_object_unref (builder);

	g_signal_connect (applet->destroy_all_dialog, "response",
			  G_CALLBACK (destroy_all_response_cb),
			  applet);

	gtk_window_set_screen (GTK_WINDOW (applet->destroy_all_dialog),
			gtk_widget_get_screen (applet->w_applet));

	gtk_widget_show_all (applet->destroy_all_dialog);
}
Esempio n. 3
0
static void
recent_documents_clear_cb (GtkMenuItem      *menuitem,
                           GtkRecentManager *manager)
{
	gpointer tmp;

	if (clear_recent_dialog != NULL) {
		gtk_window_set_screen (GTK_WINDOW (clear_recent_dialog),
				       gtk_widget_get_screen (GTK_WIDGET (menuitem)));
		gtk_window_present (GTK_WINDOW (clear_recent_dialog));
		return;
	}

	clear_recent_dialog = gtk_message_dialog_new (NULL,
						      0 /* flags */,
						      GTK_MESSAGE_WARNING,
						      GTK_BUTTONS_NONE,
						      _("Clear the Recent Documents list?"));
	gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (clear_recent_dialog),
						  _("If you clear the Recent Documents list, you clear the following:\n"
						    "\342\200\242 All items from the Places \342\206\222 Recent Documents menu item.\n"
						    "\342\200\242 All items from the recent documents list in all applications."));

	gtk_dialog_add_buttons (GTK_DIALOG (clear_recent_dialog),
				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
				PANEL_STOCK_CLEAR, GTK_RESPONSE_ACCEPT,
				NULL);

	gtk_container_set_border_width (GTK_CONTAINER (clear_recent_dialog), 6);

	gtk_window_set_title (GTK_WINDOW (clear_recent_dialog),
			      _("Clear Recent Documents"));

	gtk_dialog_set_default_response (GTK_DIALOG (clear_recent_dialog),
					 GTK_RESPONSE_ACCEPT);
	gtk_window_set_skip_taskbar_hint (GTK_WINDOW (clear_recent_dialog),
					  FALSE);

	g_signal_connect (clear_recent_dialog, "response",
			  G_CALLBACK (clear_dialog_response), manager);

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

	tmp = &clear_recent_dialog;
	g_object_add_weak_pointer (G_OBJECT (clear_recent_dialog), tmp);

	gtk_window_set_screen (GTK_WINDOW (clear_recent_dialog),
			       gtk_widget_get_screen (GTK_WIDGET (menuitem)));
	gtk_widget_show (clear_recent_dialog);
}
Esempio n. 4
0
static void
about_cb (BonoboUIComponent *uic,
          AppletData        *data,
          const gchar       *verbname)
{
  GdkScreen    *screen;

  const char *authors[] = {
    "Havoc Pennington <*****@*****.**>",
    "Anders Carlsson <*****@*****.**>",
    "Vincent Untz <*****@*****.**>",
    NULL
  };
  const char *documenters [] = {
    "Sun GNOME Documentation Team <*****@*****.**>",
    NULL
  };

  screen = gtk_widget_get_screen (GTK_WIDGET (data->applet));

  if (data->about_dialog)
    {
      gtk_window_set_screen (GTK_WINDOW (data->about_dialog), screen);
      gtk_window_present (GTK_WINDOW (data->about_dialog));
      return;
    }

  data->about_dialog = gtk_about_dialog_new ();
  g_object_set (data->about_dialog,
                "program-name", _("Notification Area"),
                "version", VERSION,
                "copyright", "Copyright \xc2\xa9 2002 Red Hat, Inc.",
                "authors", (const char **) authors,
                "documenters", (const char **) documenters,
                "translator-credits", _("translator-credits"),
                "logo-icon-name", NOTIFICATION_AREA_ICON,
                NULL);
  
  gtk_window_set_icon_name (GTK_WINDOW (data->about_dialog),
                            NOTIFICATION_AREA_ICON);
  gtk_window_set_screen (GTK_WINDOW (data->about_dialog), screen);

  g_object_add_weak_pointer (G_OBJECT (data->about_dialog),
                             (gpointer) &data->about_dialog);

  g_signal_connect (data->about_dialog, "response",
                    G_CALLBACK (gtk_widget_destroy), NULL);

  gtk_window_present (GTK_WINDOW (data->about_dialog));
}
void
meta_fixed_tip_show (Display *xdisplay, int screen_number,
                     int root_x, int root_y,
                     const char *markup_text)
{
  int w, h;
  
  if (tip == NULL)
    {      
      tip = gtk_window_new (GTK_WINDOW_POPUP);
      gtk_window_set_type_hint (GTK_WINDOW(tip), GDK_WINDOW_TYPE_HINT_TOOLTIP);

      {
        GdkScreen *gdk_screen;
	GdkRectangle monitor;
	gint mon_num;

        gdk_screen = gdk_display_get_screen (gdk_display_get_default (),
                                             screen_number);
        gtk_window_set_screen (GTK_WINDOW (tip),
                               gdk_screen);
	mon_num = gdk_screen_get_monitor_at_point (gdk_screen, root_x, root_y);
	gdk_screen_get_monitor_geometry (gdk_screen, mon_num, &monitor);
	screen_right_edge = monitor.x + monitor.width;
	screen_bottom_edge = monitor.y + monitor.height;
      }
      
      gtk_widget_set_app_paintable (tip, TRUE);
      gtk_window_set_resizable (GTK_WINDOW (tip), FALSE);
      gtk_widget_set_name (tip, "gtk-tooltips");
      gtk_container_set_border_width (GTK_CONTAINER (tip), 4);

      g_signal_connect_swapped (tip, "expose_event",
				 G_CALLBACK (expose_handler), NULL);

      label = gtk_label_new (NULL);
      gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
      gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
      gtk_widget_show (label);
      
      gtk_container_add (GTK_CONTAINER (tip), label);

      g_signal_connect (tip, "destroy",
			G_CALLBACK (gtk_widget_destroyed), &tip);
    }

  gtk_label_set_markup (GTK_LABEL (label), markup_text);
  
  gtk_window_get_size (GTK_WINDOW (tip), &w, &h);

  if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
      root_x = MAX(0, root_x - w);

  if ((root_x + w) > screen_right_edge)
    root_x -= (root_x + w) - screen_right_edge;
  
  gtk_window_move (GTK_WINDOW (tip), root_x, root_y);

  gtk_widget_show (tip);
}
GtkWidget *
gdict_source_dialog_new (GtkWindow               *parent,
			 const gchar             *title,
			 GdictSourceDialogAction  action,
			 GdictSourceLoader       *loader,
			 const gchar             *source_name)
{
  GtkWidget *retval;
  
  g_return_val_if_fail ((parent == NULL || GTK_IS_WINDOW (parent)), NULL);
  g_return_val_if_fail (GDICT_IS_SOURCE_LOADER (loader), NULL);
  
  retval = g_object_new (GDICT_TYPE_SOURCE_DIALOG,
  			 "source-loader", loader,
  			 "source-name", source_name,
  			 "action", action,
  			 "title", title,
  			 NULL);

  if (parent)
    {
      gtk_window_set_transient_for (GTK_WINDOW (retval), parent);
      gtk_window_set_destroy_with_parent (GTK_WINDOW (retval), TRUE);
      gtk_window_set_screen (GTK_WINDOW (retval),
                             gtk_widget_get_screen (GTK_WIDGET (parent)));
    }
  
  return retval;
}
Esempio n. 7
0
static void
help_cb (GtkAction  *action,
	 EyesApplet *eyes_applet)
{
	GError *error = NULL;

#if GTK_CHECK_VERSION (3, 22, 0)
	gtk_show_uri_on_window (NULL,
	                        "help:mate-geyes",
	                        gtk_get_current_event_time (),
	                        &error);
#else
	gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (eyes_applet->applet)),
	              "help:mate-geyes",
	              gtk_get_current_event_time (),
	              &error);
#endif

	if (error) {
		GtkWidget *dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
							    _("There was an error displaying help: %s"), error->message);
		g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (gtk_widget_destroy), NULL);
		gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
		gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (GTK_WIDGET (eyes_applet->applet)));
		gtk_widget_show (dialog);
		g_error_free (error);
		error = NULL;
	}
}
Esempio n. 8
0
static void display_properties_dialog(GtkAction* action, TasklistData* tasklist)
{
	if (tasklist->properties_dialog == NULL)
	{
		GtkBuilder* builder;
		GError* error;

		builder = gtk_builder_new();
		gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE);

		error = NULL;
		gtk_builder_add_from_file(builder, TASKLIST_BUILDERDIR "/window-list.ui", &error);

		if (error)
		{
			g_warning("Error loading preferences: %s", error->message);
			g_error_free(error);
			return;
		}

		tasklist->properties_dialog = WID("tasklist_properties_dialog");

		g_object_add_weak_pointer(G_OBJECT(tasklist->properties_dialog), (void**) &tasklist->properties_dialog);

		setup_dialog(builder, tasklist);

		g_object_unref(builder);
	}

	gtk_window_set_icon_name(GTK_WINDOW(tasklist->properties_dialog), WINDOW_LIST_ICON);

	gtk_window_set_resizable(GTK_WINDOW(tasklist->properties_dialog), FALSE);
	gtk_window_set_screen(GTK_WINDOW(tasklist->properties_dialog), gtk_widget_get_screen(tasklist->applet));
	gtk_window_present(GTK_WINDOW(tasklist->properties_dialog));
}
Esempio n. 9
0
void
gimp_popup_show (GimpPopup *popup,
                 GtkWidget *widget)
{
    GdkScreen      *screen;
    GtkRequisition  requisition;
    GtkAllocation   allocation;
    GdkRectangle    rect;
    gint            monitor;
    gint            orig_x;
    gint            orig_y;
    gint            x;
    gint            y;

    g_return_if_fail (GIMP_IS_POPUP (popup));
    g_return_if_fail (GTK_IS_WIDGET (widget));

    gtk_widget_size_request (GTK_WIDGET (popup), &requisition);

    gtk_widget_get_allocation (widget, &allocation);
    gdk_window_get_origin (gtk_widget_get_window (widget), &orig_x, &orig_y);

    if (! gtk_widget_get_has_window (widget))
    {
        orig_x += allocation.x;
        orig_y += allocation.y;
    }

    screen = gtk_widget_get_screen (widget);

    monitor = gdk_screen_get_monitor_at_point (screen, orig_x, orig_y);
    gdk_screen_get_monitor_workarea (screen, monitor, &rect);

    if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
    {
        x = orig_x + allocation.width - requisition.width;

        if (x < rect.x)
            x -= allocation.width - requisition.width;
    }
    else
    {
        x = orig_x;

        if (x + requisition.width > rect.x + rect.width)
            x += allocation.width - requisition.width;
    }

    y = orig_y + allocation.height;

    if (y + requisition.height > rect.y + rect.height)
        y = orig_y - requisition.height;

    gtk_window_set_screen (GTK_WINDOW (popup), screen);
    gtk_window_set_transient_for (GTK_WINDOW (popup),
                                  GTK_WINDOW (gtk_widget_get_toplevel (widget)));

    gtk_window_move (GTK_WINDOW (popup), x, y);
    gtk_widget_show (GTK_WIDGET (popup));
}
Esempio n. 10
0
void
mc_show_preferences (GtkAction *action,
		     MCData    *mc)
{
    if (!mc->prefs_dialog.dialog) {
	GtkBuilder *builder;

	builder = gtk_builder_new ();
	gtk_builder_add_from_file (builder, GTK_BUILDERDIR "/mini-commander.ui", NULL);

	mc->prefs_dialog.dialog = GTK_WIDGET (gtk_builder_get_object (builder,
			"mc_preferences_dialog"));

	g_object_add_weak_pointer (G_OBJECT (mc->prefs_dialog.dialog),
				   (gpointer *) &mc->prefs_dialog.dialog);

	mc_preferences_setup_dialog (builder, mc);

	g_object_unref (builder);
    }

    gtk_window_set_screen (GTK_WINDOW (mc->prefs_dialog.dialog),
			   gtk_widget_get_screen (GTK_WIDGET (mc->applet)));
    gtk_window_present (GTK_WINDOW (mc->prefs_dialog.dialog));
}
static void
response_cb (GtkWidget    *widget,
	     int           id,
	     TasklistData *tasklist)
{
	if (id == GTK_RESPONSE_HELP) {
		GError *error = NULL;

		gnome_help_display_desktop_on_screen (
			NULL, "window-list", "window-list", "windowlist-prefs",
			gtk_widget_get_screen (tasklist->applet),
			&error);
		if (error) {
			GtkWidget *dialog;
			dialog = gtk_message_dialog_new (GTK_WINDOW (widget),
							 GTK_DIALOG_DESTROY_WITH_PARENT,
							 GTK_MESSAGE_ERROR,
							 GTK_BUTTONS_OK,
							  _("There was an error displaying help: %s"),
							 error->message);

			g_signal_connect (dialog, "response",
					  G_CALLBACK (gtk_widget_destroy),
					  NULL);
	
			gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
			gtk_window_set_screen (GTK_WINDOW (dialog),
					       gtk_widget_get_screen (tasklist->applet));
			gtk_widget_show (dialog);
			g_error_free (error);
		}
	} else
		gtk_widget_hide (widget);
}
static void 
display_properties_dialog (BonoboUIComponent *uic,
			   TasklistData      *tasklist,
			   const gchar       *verbname)
{
	if (tasklist->properties_dialog == NULL) {
		GladeXML  *xml;

		xml = glade_xml_new (TASKLIST_GLADEDIR "/window-list.glade", NULL, NULL);
		tasklist->properties_dialog = glade_xml_get_widget (xml, "tasklist_properties_dialog");

		g_object_add_weak_pointer (G_OBJECT (tasklist->properties_dialog),
					   (void**) &tasklist->properties_dialog);

		setup_dialog (xml, tasklist);
		
		g_object_unref (G_OBJECT (xml));
	}

	gtk_window_set_icon_name (GTK_WINDOW (tasklist->properties_dialog),
				  "gnome-panel-window-list"); 

	gtk_window_set_resizable (GTK_WINDOW (tasklist->properties_dialog), FALSE);
	gtk_window_set_screen (GTK_WINDOW (tasklist->properties_dialog),
			       gtk_widget_get_screen (tasklist->applet));
	gtk_window_present (GTK_WINDOW (tasklist->properties_dialog));
}
Esempio n. 13
0
static void
prefs_response_cb (GtkDialog *dialog, gint response, gpointer data)
{
	GError *error = NULL;
	if (response == GTK_RESPONSE_HELP) {
		egg_help_display_on_screen ("wireless", "wireless-prefs",
					    gtk_widget_get_screen (GTK_WIDGET (
					    dialog)), &error);
		if (error) {
			GtkWidget *dlg =
			gtk_message_dialog_new (GTK_WINDOW (dialog),
						GTK_DIALOG_DESTROY_WITH_PARENT
						|| GTK_DIALOG_MODAL,
						GTK_MESSAGE_ERROR,
						GTK_BUTTONS_CLOSE,
						_("There was an error displaying help: %s"),
						error->message);
			g_signal_connect (G_OBJECT (dlg), "response",
					  G_CALLBACK (gtk_widget_destroy),
					  NULL);
			gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
			gtk_window_set_screen (GTK_WINDOW (dlg),
					       gtk_widget_get_screen (
							GTK_WIDGET (dialog)));
			gtk_widget_show (dlg);
			g_error_free (error);
		}
	}
	else
		gtk_widget_hide (GTK_WIDGET (dialog));
}
Esempio n. 14
0
static UniqueResponse message_received_cb(UniqueApp* app, UniqueCommand command, UniqueMessageData* message, guint time, gpointer user_data)
{
	UniqueResponse res;
	AppShellData* app_data = user_data;

	switch (command)
	{
		case UNIQUE_ACTIVATE:
			/* move the main window to the screen that sent us the command */
			gtk_window_set_screen(GTK_WINDOW(app_data->main_app), unique_message_data_get_screen(message));

			if (!app_data->main_app_window_shown_once)
			{
				show_shell(app_data);
			}

			gtk_window_present_with_time(GTK_WINDOW(app_data->main_app), time);

			gtk_widget_grab_focus(SLAB_SECTION(app_data->filter_section)->contents);

			res = UNIQUE_RESPONSE_OK;

			break;
		default:
			res = UNIQUE_RESPONSE_PASSTHROUGH;
			break;
	}

	return res;
}
Esempio n. 15
0
GtkWidget *
do_theming_style_classes (GtkWidget *do_widget)
{
  GtkWidget *grid;
  GtkBuilder *builder;

  if (!window)
    {
      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
      gtk_window_set_screen (GTK_WINDOW (window),
                             gtk_widget_get_screen (do_widget));
      gtk_window_set_title (GTK_WINDOW (window), "Style Classes");
      gtk_container_set_border_width (GTK_CONTAINER (window), 12);
      g_signal_connect (window, "destroy",
                        G_CALLBACK (gtk_widget_destroyed), &window);

      builder = gtk_builder_new_from_resource ("/theming_style_classes/theming.ui");

      grid = (GtkWidget *)gtk_builder_get_object (builder, "grid");
      gtk_widget_show_all (grid);
      gtk_container_add (GTK_CONTAINER (window), grid);
      g_object_unref (builder);
    }

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

  return window;
}
Esempio n. 16
0
static void display_properties_dialog(GtkAction* action, PagerData* pager)
{
	if (pager->properties_dialog == NULL)
	{
		GtkBuilder* builder;
		GError* error;

		builder = gtk_builder_new();
		gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE);

		error = NULL;
		gtk_builder_add_from_file(builder, PAGER_BUILDERDIR "/workspace-switcher.ui", &error);

		if (error)
		{
			g_warning("Error loading preferences: %s", error->message);
			g_error_free(error);
			return;
		}

		pager->properties_dialog = WID("pager_properties_dialog");

		g_object_add_weak_pointer(G_OBJECT(pager->properties_dialog), (gpointer*) &pager->properties_dialog);

		setup_dialog(builder, pager);

		g_object_unref(builder);
	}

	gtk_window_set_icon_name(GTK_WINDOW(pager->properties_dialog), WORKSPACE_SWITCHER_ICON);
	gtk_window_set_screen(GTK_WINDOW(pager->properties_dialog), gtk_widget_get_screen(pager->applet));
	gtk_window_present(GTK_WINDOW(pager->properties_dialog));
}
Esempio n. 17
0
static void
macro_add (GtkWidget *button,
           MCData    *mc)
{
    if (!mc->prefs_dialog.macro_add_dialog) {
	GtkBuilder *builder;

	builder = gtk_builder_new ();
	gtk_builder_add_from_file (builder, GTK_BUILDERDIR "/mini-commander.ui", NULL);

	mc->prefs_dialog.macro_add_dialog = GTK_WIDGET (gtk_builder_get_object (builder, "mc_macro_add_dialog"));

	g_object_add_weak_pointer (G_OBJECT (mc->prefs_dialog.macro_add_dialog),
				   (gpointer *) &mc->prefs_dialog.macro_add_dialog);

	setup_add_dialog (builder, mc);

	g_object_unref (builder);
    }

    gtk_window_set_screen (GTK_WINDOW (mc->prefs_dialog.macro_add_dialog),
			   gtk_widget_get_screen (GTK_WIDGET (mc->applet)));
    gtk_widget_grab_focus (mc->prefs_dialog.pattern_entry);
    gtk_window_present (GTK_WINDOW (mc->prefs_dialog.macro_add_dialog));
}
static void 
display_properties_dialog (BonoboUIComponent *uic,
			   PagerData         *pager,
			   const gchar       *verbname)
{
	if (pager->properties_dialog == NULL) {
		GladeXML  *xml;

		xml = glade_xml_new (PAGER_GLADEDIR "/workspace-switcher.glade", NULL, NULL);
		pager->properties_dialog = glade_xml_get_widget (xml, "pager_properties_dialog");

		g_object_add_weak_pointer (G_OBJECT (pager->properties_dialog), 
					   (gpointer *) &pager->properties_dialog);

		setup_dialog (xml, pager);
		
		g_object_unref (G_OBJECT (xml));
	}

	gtk_window_set_icon_name (GTK_WINDOW (pager->properties_dialog),
	                          "gnome-panel-workspace-switcher");
	gtk_window_set_screen (GTK_WINDOW (pager->properties_dialog),
			       gtk_widget_get_screen (pager->applet));
	gtk_window_present (GTK_WINDOW (pager->properties_dialog));
}
Esempio n. 19
0
static UniqueResponse
unique_app_message_cb (UniqueApp *unique_app,
    gint command,
    UniqueMessageData *data,
    guint timestamp,
    gpointer user_data)
{
  GtkWindow *window = user_data;

  DEBUG ("Other instance launched, presenting the main window. "
      "Command=%d, timestamp %u", command, timestamp);

  if (command == COMMAND_ACCOUNTS_DIALOG)
    {
      show_accounts_ui (window, TRUE);
    }
  else
    {
      /* We're requested to show stuff again, disable the start hidden global
       * in case the accounts wizard wants to pop up.
       */
      start_hidden = FALSE;

      show_accounts_ui (window, FALSE);

      gtk_window_set_screen (GTK_WINDOW (window),
          unique_message_data_get_screen (data));
      gtk_window_set_startup_id (GTK_WINDOW (window),
          unique_message_data_get_startup_id (data));
      gtk_window_present_with_time (GTK_WINDOW (window), timestamp);
    }

  return UNIQUE_RESPONSE_OK;
}
Esempio n. 20
0
/**
 * ev_application_open_window:
 * @application: The instance of the application.
 * @timestamp: Current time value.
 *
 * Creates a new window
 */
void
ev_application_open_window (EvApplication *application,
			    GdkScreen     *screen,
			    guint32        timestamp)
{
	GtkWidget *new_window = ev_window_new ();
#ifdef GDK_WINDOWING_X11
	GdkWindow *gdk_window;
#endif

	if (screen) {
		ev_stock_icons_set_screen (screen);
		gtk_window_set_screen (GTK_WINDOW (new_window), screen);
	}

	if (!gtk_widget_get_realized (new_window))
		gtk_widget_realize (new_window);

#ifdef GDK_WINDOWING_X11
	gdk_window = gtk_widget_get_window (GTK_WIDGET (new_window));

	if (timestamp <= 0)
		timestamp = gdk_x11_get_server_time (gdk_window);
	gdk_x11_window_set_user_time (gdk_window, timestamp);

	gtk_window_present (GTK_WINDOW (new_window));
#else
	gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp);
#endif /* GDK_WINDOWING_X11 */
}
Esempio n. 21
0
static void
ensure_size_window (MetaResizePopup *popup)
{
  GdkVisual *visual;
  GdkScreen *screen;

  if (popup->size_window)
    return;

  popup->size_window = gtk_window_new (GTK_WINDOW_POPUP);
  screen = gdk_display_get_screen (gdk_x11_lookup_xdisplay (popup->display),
                                   popup->screen_number);
  visual = gdk_screen_get_rgba_visual (screen);

  gtk_window_set_screen (GTK_WINDOW (popup->size_window), screen);
  if (visual != NULL)
    gtk_widget_set_visual (popup->size_window, visual);

  gtk_window_set_type_hint (GTK_WINDOW (popup->size_window),
                            GDK_WINDOW_TYPE_HINT_TOOLTIP);
  gtk_window_set_resizable (GTK_WINDOW (popup->size_window), FALSE);

  gtk_widget_set_app_paintable (popup->size_window, TRUE);
  gtk_style_context_add_class (gtk_widget_get_style_context (popup->size_window),
                               GTK_STYLE_CLASS_TOOLTIP);
  g_signal_connect (popup->size_window, "draw",
                    G_CALLBACK (size_window_draw), popup);

  popup->size_label = gtk_label_new ("");
  g_object_set (popup->size_label, "margin", 6, NULL);

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

  gtk_widget_show (popup->size_label);
}
Esempio n. 22
0
static void
display_help (GtkAction *action,
	      DriveList *drive_list)
{
    GdkScreen *screen;
    GError *error = NULL;

    screen = gtk_widget_get_screen (GTK_WIDGET (drive_list));

    gtk_show_uri (screen,
		"help:mate-drivemount",
		gtk_get_current_event_time (),
		&error);

    if (error) {
	GtkWidget *dialog;

	dialog = gtk_message_dialog_new (NULL,
					 GTK_DIALOG_MODAL,
					 GTK_MESSAGE_ERROR,
					 GTK_BUTTONS_OK,
					 _("There was an error displaying help: %s"),
					 error->message);
	g_signal_connect (dialog, "response",
			  G_CALLBACK (gtk_widget_destroy), NULL);
	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
	gtk_window_set_screen (GTK_WINDOW (dialog), screen);
	gtk_widget_show (dialog);
	g_error_free (error);
    }
}
Esempio n. 23
0
gboolean
tray_toggle_visibility(gboolean force_hide)
{
	static int x, y;
	static GdkScreen *screen;
	GtkWindow *win;
	session *sess = sess_list->data;

	if (!sticon)
		return FALSE;

	win = fe_gui_info_ptr(sess, 0);

	tray_stop_flash();
	tray_reset_counts();

	if (!win)
		return FALSE;

	if (force_hide || GTK_WIDGET_VISIBLE(win))
	{
		gtk_window_get_position(win, &x, &y);
		screen = gtk_window_get_screen(win);
		gtk_widget_hide(GTK_WIDGET(win));
	}
	else
	{
		gtk_window_set_screen(win, screen);
		gtk_window_move(win, x, y);
		gtk_widget_show(GTK_WIDGET (win));
		gtk_window_present(win);
	}

	return TRUE;
}
Esempio n. 24
0
MetaImageWindow*
meta_image_window_new (Display *xdisplay,
                       int      screen_number,
                       int      max_width,
                       int      max_height)
{
  MetaImageWindow *iw;
  GdkDisplay *gdisplay;
  GdkScreen *gscreen;

  iw = g_new (MetaImageWindow, 1);
  iw->window = gtk_window_new (GTK_WINDOW_POPUP);

  gdisplay = gdk_x11_lookup_xdisplay (xdisplay);
  gscreen = gdk_display_get_screen (gdisplay, screen_number);

  gtk_window_set_screen (GTK_WINDOW (iw->window), gscreen);

  gtk_widget_realize (iw->window);
  iw->pixmap = gdk_pixmap_new (gtk_widget_get_window (iw->window),
                               max_width, max_height,
                               -1);

  gtk_widget_set_size_request (iw->window, 1, 1);
  gtk_widget_set_double_buffered (iw->window, FALSE);
  gtk_widget_set_app_paintable (iw->window, TRUE);

  return iw;
}
static void 
display_properties_dialog (GtkAction *action,
			   PagerData *pager)
{
	if (pager->properties_dialog == NULL) {
		GtkBuilder *builder;

		builder = gtk_builder_new ();
		gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
		gtk_builder_add_from_resource (builder, WNCKLET_RESOURCE_PATH "workspace-switcher.ui", NULL);

		pager->properties_dialog = WID ("pager_properties_dialog");

		g_object_add_weak_pointer (G_OBJECT (pager->properties_dialog), 
					   (gpointer *) &pager->properties_dialog);

		setup_dialog (builder, pager);
		
		g_object_unref (builder);
	}

	gtk_window_set_icon_name (GTK_WINDOW (pager->properties_dialog),
	                          WORKSPACE_SWITCHER_ICON);
	gtk_window_set_screen (GTK_WINDOW (pager->properties_dialog),
			       gtk_widget_get_screen (pager->applet));
	gtk_window_present (GTK_WINDOW (pager->properties_dialog));
}
Esempio n. 26
0
/* TODO - Must HIGgify this dialog */
static void
error_dialog (TrashApplet *applet, const gchar *error, ...)
{
  va_list args;
  gchar *error_string;
  GtkWidget *dialog;

  g_return_if_fail (error != NULL);

  va_start (args, error);
  error_string = g_strdup_vprintf (error, args);
  va_end (args);

  dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
                                   GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
                                   "%s", error_string);

  g_signal_connect (G_OBJECT (dialog), "response",
                    G_CALLBACK (gtk_widget_destroy),
                    NULL);

  gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
  gtk_window_set_screen (GTK_WINDOW(dialog),
                         gtk_widget_get_screen (GTK_WIDGET (applet)));
  gtk_widget_show (dialog);

  g_free (error_string);
}
Esempio n. 27
0
static void popup_error_dialog(AccessxStatusApplet* sapplet)
{
    GtkWidget* dialog;
    gchar* error_txt;

    switch (sapplet->error_type)
    {
    case ACCESSX_STATUS_ERROR_XKB_DISABLED:
        error_txt = g_strdup(_("XKB Extension is not enabled"));
        break;

    case ACCESSX_STATUS_ERROR_UNKNOWN:

    default:
        error_txt = g_strdup(_("Unknown error"));
        break;
    }

    dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Error: %s"), error_txt);

    g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), NULL);

    gtk_window_set_screen(GTK_WINDOW(dialog), gtk_widget_get_screen(GTK_WIDGET(sapplet->applet)));

    gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);

    gtk_widget_show(dialog);
    g_free(error_txt);
}
Esempio n. 28
0
static gboolean
gdict_applet_icon_toggled_cb (GtkWidget   *widget,
			      GdictApplet *applet)
{
  GdictAppletPrivate *priv = applet->priv;

  if (!priv->window)
    gdict_applet_build_window (applet);
  
  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
    {
      gtk_window_set_screen (GTK_WINDOW (priv->window),
	                     gtk_widget_get_screen (GTK_WIDGET (applet)));
      gtk_window_present (GTK_WINDOW (priv->window));
      gtk_widget_grab_focus (priv->defbox);
      
      priv->is_window_showing = TRUE;
    }
  else
    {
      /* force hiding the find pane */
      gdict_defbox_set_show_find (GDICT_DEFBOX (priv->defbox), FALSE);

      gtk_widget_grab_focus (priv->entry);
      gtk_widget_hide (priv->window);
      
      priv->is_window_showing = FALSE;
    }

  return FALSE;
}
void
gimp_display_shell_layer_select_init (GimpDisplayShell *shell,
                                      gint              move,
                                      guint32           time)
{
  LayerSelect *layer_select;
  GimpImage   *image;
  GimpLayer   *layer;

  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));

  image = gimp_display_get_image (shell->display);

  layer = gimp_image_get_active_layer (image);

  if (! layer)
    return;

  layer_select = layer_select_new (image, layer,
                                   image->gimp->config->layer_preview_size);
  layer_select_advance (layer_select, move);

  gtk_window_set_screen (GTK_WINDOW (layer_select->window),
                         gtk_widget_get_screen (GTK_WIDGET (shell)));

  gtk_widget_show (layer_select->window);

  gdk_keyboard_grab (gtk_widget_get_window (layer_select->window), FALSE, time);
}
Esempio n. 30
0
JNIEXPORT void JNICALL
Java_org_gnome_gtk_GtkWindow_gtk_1window_1set_1screen
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jlong _screen
)
{
	GtkWindow* self;
	GdkScreen* screen;

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

	// convert parameter screen
	screen = (GdkScreen*) _screen;

	// call function
	gtk_window_set_screen(self, screen);

	// cleanup parameter self

	// cleanup parameter screen
}