Exemplo n.º 1
0
static void
mate_volume_applet_dock_init (MateVolumeAppletDock *dock)
{
  dock->orientation = -1;
  dock->timeout = 0;

#if 1
  /* We can't use a simple GDK_WINDOW_TYPE_HINT_DOCK here since
   * the dock windows don't accept input by default. Instead we use
   * the popup menu type. In the end we set everything by hand anyway
   * since what happens depends very heavily on the window manager. */
//  gtk_window_set_type_hint (GTK_WINDOW (dock),
//      			    GDK_WINDOW_TYPE_HINT_POPUP_MENU);
  gtk_window_set_keep_above (GTK_WINDOW (dock), TRUE);
  gtk_window_set_decorated (GTK_WINDOW (dock), FALSE);
  gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dock), TRUE);
  gtk_window_set_skip_pager_hint (GTK_WINDOW (dock), TRUE);
  gtk_window_set_resizable (GTK_WINDOW (dock), FALSE);
  gtk_window_stick (GTK_WINDOW (dock));
#else
  /* This works well, except that keyboard focus is impossible. */
  gtk_window_set_type_hint (GTK_WINDOW (dock),
      			    GDK_WINDOW_TYPE_HINT_DOCK);
  gtk_window_set_decorated (GTK_WINDOW (dock), FALSE);
  gtk_window_set_resizable (GTK_WINDOW (dock), FALSE);
  gtk_window_stick (GTK_WINDOW (dock));
  GTK_WIDGET_SET_FLAGS (dock, GTK_CAN_FOCUS);
#endif
}
Exemplo n.º 2
0
void mainwindow_toggle(int sig)
{
    if((!sig && GTK_WIDGET_VISIBLE(mainwindow)) || (sig && toggled))
    {
        gdk_threads_enter();
        gtk_widget_hide(GTK_WIDGET(mainwindow));
        gdk_flush();
        gdk_threads_leave();
        toggled = FALSE;
        return;
    }
    
    toggled = TRUE;
    gdk_threads_enter();
    
    /* reset the window position before displaying it to avoid flickering if the
       windos is moved */
    mainwindow_reset_position();
    
    if(gtk_window_is_active(GTK_WINDOW(mainwindow)) == FALSE)
        gtk_window_present(GTK_WINDOW(mainwindow));
    else
        gtk_widget_show(mainwindow);
    
    gtk_window_stick(GTK_WINDOW(mainwindow));
    gtk_window_set_keep_above(GTK_WINDOW(mainwindow), TRUE);
    gdk_window_focus(mainwindow->window, gtk_get_current_event_time());
    gdk_flush();
    gdk_threads_leave();
}
static void
gsm_logout_dialog_init (GsmLogoutDialog *logout_dialog)
{
        logout_dialog->priv = GSM_LOGOUT_DIALOG_GET_PRIVATE (logout_dialog);

        logout_dialog->priv->timeout_id = 0;
        logout_dialog->priv->timeout = 0;
        logout_dialog->priv->default_response = GTK_RESPONSE_CANCEL;

        gtk_window_set_skip_taskbar_hint (GTK_WINDOW (logout_dialog), TRUE);
        gtk_window_set_keep_above (GTK_WINDOW (logout_dialog), TRUE);
        gtk_window_stick (GTK_WINDOW (logout_dialog));
#ifdef HAVE_UPOWER
        logout_dialog->priv->up_client = up_client_new ();
#endif
#ifdef HAVE_SYSTEMD
        if (LOGIND_RUNNING())
            logout_dialog->priv->systemd = gsm_get_systemd ();
        else
#endif
        logout_dialog->priv->consolekit = gsm_get_consolekit ();

        g_signal_connect (logout_dialog,
                          "destroy",
                          G_CALLBACK (gsm_logout_dialog_destroy),
                          NULL);

        g_signal_connect (logout_dialog,
                          "show",
                          G_CALLBACK (gsm_logout_dialog_show),
                          NULL);
}
void gldi_desklet_set_sticky (CairoDesklet *pDesklet, gboolean bSticky)
{
	//g_print ("%s (%d)\n", __func__, bSticky);
	int iNumDesktop;
	if (bSticky)
	{
		gtk_window_stick (GTK_WINDOW (pDesklet->container.pWidget));
		iNumDesktop = -1;
	}
	else
	{
		gtk_window_unstick (GTK_WINDOW (pDesklet->container.pWidget));
		int iCurrentDesktop, iCurrentViewportX, iCurrentViewportY;
		gldi_desktop_get_current (&iCurrentDesktop, &iCurrentViewportX, &iCurrentViewportY);
		iNumDesktop = iCurrentDesktop * g_desktopGeometry.iNbViewportX * g_desktopGeometry.iNbViewportY + iCurrentViewportX * g_desktopGeometry.iNbViewportY + iCurrentViewportY;
		cd_debug (">>> on colle ce desklet sur le bureau %d", iNumDesktop);
	}
	
	//\_________________ On enregistre le nouvel etat.
	Icon *icon = pDesklet->pIcon;
	if (CAIRO_DOCK_IS_APPLET (icon))
		cairo_dock_update_conf_file (icon->pModuleInstance->cConfFilePath,
			G_TYPE_BOOLEAN, "Desklet", "sticky", bSticky,
			G_TYPE_INT, "Desklet", "num desktop", iNumDesktop,
			G_TYPE_INVALID);
}
Exemplo n.º 5
0
/* Display a window containing the standard calendar widget. */
static GtkWidget * dclock_create_calendar(DClockPlugin * dc)
{
    /* Create a new window. */
    GtkWidget * win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size(GTK_WINDOW(win), 180, 180);
    gtk_window_set_decorated(GTK_WINDOW(win), FALSE);
    gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
    gtk_container_set_border_width(GTK_CONTAINER(win), 5);
    gtk_window_set_skip_taskbar_hint(GTK_WINDOW(win), TRUE);
    gtk_window_set_skip_pager_hint(GTK_WINDOW(win), TRUE);
    gtk_window_stick(GTK_WINDOW(win));

    /* Create a vertical box as a child of the window. */
    GtkWidget * box = gtk_vbox_new(FALSE, 0);
    gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(box));

    /* Create a standard calendar widget as a child of the vertical box. */
    GtkWidget * calendar = gtk_calendar_new();
    gtk_calendar_display_options(
        GTK_CALENDAR(calendar),
        GTK_CALENDAR_SHOW_WEEK_NUMBERS | GTK_CALENDAR_SHOW_DAY_NAMES | GTK_CALENDAR_SHOW_HEADING);
    gtk_box_pack_start_defaults(GTK_BOX(box), calendar);

    /* Connect signals. */
    g_signal_connect(G_OBJECT(win), "map", G_CALLBACK(dclock_popup_map), dc);

    /* Return the widget. */
    return win;
}
static void
csm_logout_dialog_init (CsmLogoutDialog *logout_dialog)
{
        logout_dialog->priv = CSM_LOGOUT_DIALOG_GET_PRIVATE (logout_dialog);

        logout_dialog->priv->timeout_id = 0;
        logout_dialog->priv->timeout = 0;
        logout_dialog->priv->default_response = GTK_RESPONSE_CANCEL;

        gtk_window_set_skip_taskbar_hint (GTK_WINDOW (logout_dialog), TRUE);
        gtk_window_set_keep_above (GTK_WINDOW (logout_dialog), TRUE);
        gtk_window_stick (GTK_WINDOW (logout_dialog));

#ifdef HAVE_OLD_UPOWER
        logout_dialog->priv->up_client = up_client_new ();
#endif

        logout_dialog->priv->system = csm_get_system ();

        g_signal_connect (logout_dialog,
                          "destroy",
                          G_CALLBACK (csm_logout_dialog_destroy),
                          NULL);

        g_signal_connect (logout_dialog,
                          "show",
                          G_CALLBACK (csm_logout_dialog_show),
                          NULL);
}
Exemplo n.º 7
0
int main(int argc,char **argv)
{
#ifdef _USEQT5_
	QApplication	app(argc,argv);
#endif
	AspellCanHaveError*	possible_err;

	aspellConfig=new_aspell_config();
	possible_err=new_aspell_speller(aspellConfig);

	if(aspell_error_number(possible_err)!= 0)
		puts(aspell_error_message(possible_err));
	else
		spellChecker=to_aspell_speller(possible_err);

#ifndef _USEQT5_
	gtk_init(&argc,&argv);

	buildMainGuiGtk();
	gtk_window_stick(GTK_WINDOW(window));
	gtk_window_set_keep_above((GtkWindow*)window,true);
	gtk_widget_show_all(window);
	gtk_main();
#else
	holdapp=&app;
	buildMainGuiQt();
	window->show();
	app.exec();
#endif
}
Exemplo n.º 8
0
void 
cid_read_config_after_update (CidMainContainer **pCid, const char *f) 
{
    CidMainContainer *cid = *pCid;
    cid_read_config (pCid, f);
    
    // Si on active les fonctions 'instables', on détruit puis recree la fenetre
    if ((cid->config->bChangedTestingConf != (cid->config->bUnstable && cid->config->bTesting))) 
    {
        cid->config->bChangedTestingConf = cid->config->bTesting && cid->config->bUnstable;
        gtk_widget_destroy(cid->pWindow);
        cid_create_main_window();
    }
    
    // Si on change de lecteur
    if (iPlayerChanged != cid->config->iPlayer) 
    {
        cid_disconnect_player ();
    
        cid_free_musicData();
    
        if (cid->runtime->pMonitorList) 
        {
            //g_slice_free (CidControlFunctionsList,cid->runtime->pMonitorList);
            cid->runtime->pMonitorList = NULL;
        }
    
    
        cid_run_with_player(pCid);
    }
    
    // Si la couleur des controles change, on les recharge
    if (iSymbolChanged != cid->config->iSymbolColor || iPlayerChanged != cid->config->iPlayer)
        cid_load_symbols();
    
    cid_check_position();
    
    gtk_window_move (GTK_WINDOW(cid->pWindow), cid->config->iPosX, cid->config->iPosY);
    gtk_window_resize (GTK_WINDOW (cid->pWindow), cid->config->iWidth, cid->config->iHeight);
    
    // Si on change l'affichage
    if (bChangedDesktop != cid->config->bAllDesktop) 
    {
        if (!cid->config->bAllDesktop)
            gtk_window_unstick(GTK_WINDOW(cid->pWindow));
        else
            gtk_window_stick(GTK_WINDOW(cid->pWindow));
    }
    
    // Enfin, si on redimenssionne, on recharge les images
    if (cid->config->iWidth != iOldWidth || cid->config->iHeight != iOldHeight) 
    {
        cid_display_image (musicData.playing_cover);
        cid_load_symbols();
    }
    
    CID_REDRAW;
    
}
Exemplo n.º 9
0
int
setupwindow()
{
  GdkPixmap *background;
  GdkPixbuf *pixbuf;
  GdkPixbuf *scaled;
  GdkScreen *screen;
  GdkColormap *colormap;
  GError *error=NULL;
  GtkStyle *style;

  window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
  g_signal_connect(G_OBJECT(window), "expose_event", G_CALLBACK(expose_window),NULL);
  gtk_window_set_title(GTK_WINDOW(window), "clock");
  gtk_window_stick(GTK_WINDOW(window));
  gtk_window_set_resizable(GTK_WINDOW(window),TRUE);
  gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window),TRUE);
  gtk_window_set_keep_above(GTK_WINDOW(window),TRUE);
  gtk_container_set_border_width(GTK_CONTAINER(window), 3);
  gtk_window_set_decorated(GTK_WINDOW(window),TRUE);
  gtk_window_set_default_size(GTK_WINDOW(window),100,100);
  gtk_widget_set_app_paintable(window,TRUE);

  /* Get the screen to get the colormap */
  screen=gtk_widget_get_screen(window);
  colormap = gdk_screen_get_rgba_colormap(screen);
  if(colormap != NULL){
    alpha_channel_support=TRUE;
  } else {
    alpha_channel_support=FALSE;
    colormap=gdk_screen_get_rgb_colormap(screen);
    g_print("Sorry, no alpha!\n");
  }
  /* Tell the window to use the colormap */
  gtk_widget_set_colormap(window,colormap);

  /* Get a pixbuf from the image file */
  pixbuf=gdk_pixbuf_new_from_file("clockface.png",&error);

  if(pixbuf==NULL){
    g_print("Failed to open background image: %s\n", error->message);
    g_error_free(error);
    error=NULL;
    return 0;
  }
  /* Make it the same size as the window */
  scaled=gdk_pixbuf_scale_simple(pixbuf,100,100, GDK_INTERP_BILINEAR);
  /* Render it using the colormap of the window */
  gdk_pixbuf_render_pixmap_and_mask_for_colormap(scaled,colormap,&background,NULL,0);
  /* Make a new style, stick the background in it, tell window to use it. */
  style = gtk_style_new();
  style->bg_pixmap[0] = background;
  gtk_widget_set_style(GTK_WIDGET(window),GTK_STYLE(style));

  /*gtk_window_set_opacity(GTK_WINDOW(window),0.3);*/
  gtk_window_move(GTK_WINDOW(window), 0, 0);
  gtk_widget_show_all(window);
  return 1;
}
Exemplo n.º 10
0
void gMainWindow::setSticky(bool vl)
{
	sticky=vl;
	if (!isTopLevel()) return;

	if (vl) gtk_window_stick(GTK_WINDOW(border));
	else    gtk_window_unstick(GTK_WINDOW(border));
}
Exemplo n.º 11
0
gboolean
mt_ctw_init (MTClosure *mt, gint x, gint y)
{
    GtkWidget *ctw, *w;
    GError *error = NULL;
    const gchar *b[] = { "single", "double", "drag", "right" };
    GSList *group;
    gpointer data;
    gint i;

    mt->ui = gtk_builder_new ();
    gtk_builder_add_from_file (mt->ui, DATADIR "/mousetweaks.ui", &error);
    if (error) {
	g_print ("%s\n", error->message);
	g_error_free (error);

	g_object_unref (mt->ui);
	mt->ui = NULL;

	return FALSE;
    }

    ctw = mt_ctw_get_window (mt);
    gtk_window_stick (GTK_WINDOW (ctw));
    gtk_window_set_keep_above (GTK_WINDOW (ctw), TRUE);
    g_signal_connect (ctw, "delete-event", G_CALLBACK (ctw_delete_cb), mt);

    for (i = 0; i < N_CLICK_TYPES; i++) {
	w = WID (b[i]);
	gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (w), FALSE);
	g_signal_connect (w, "toggled", G_CALLBACK (ctw_button_cb), mt);
	g_signal_connect (w, "button-press-event",
			  G_CALLBACK (ctw_context_menu), mt);
    }

    g_signal_connect (WID ("text"), "toggled", 
		      G_CALLBACK (ctw_menu_toggled), mt);
    g_signal_connect (WID ("icon"), "toggled", 
		      G_CALLBACK (ctw_menu_toggled), mt);
    w = WID ("both");
    g_signal_connect (w, "toggled", 
		      G_CALLBACK (ctw_menu_toggled), mt);
    group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (w));
    data = g_slist_nth_data (group, mt->style);
    gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (data), TRUE);

    gtk_widget_realize (ctw);
    mt_ctw_update_style (mt, mt->style);
    mt_ctw_update_sensitivity (mt);
    mt_ctw_update_visibility (mt);

    if (x != -1 && y != -1)
	gtk_window_move (GTK_WINDOW (ctw), x, y);

    return TRUE;
}
Exemplo n.º 12
0
static GtkWidget *
display_popup_window (GdkScreen *screen)
{
	GtkWidget     *retval;
	GtkWidget     *vbox;
	GtkWidget     *image;
	GtkWidget     *frame;
	GtkWidget     *label;
	int            screen_width, screen_height;
	GtkAllocation  allocation;

	retval = gtk_window_new (GTK_WINDOW_POPUP);
	atk_object_set_role (gtk_widget_get_accessible (retval), ATK_ROLE_ALERT);
	gtk_window_set_screen (GTK_WINDOW (retval), screen);
	gtk_window_stick (GTK_WINDOW (retval));
	gtk_widget_add_events (retval, GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK);

	frame = gtk_frame_new (NULL);
	gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
	gtk_container_add (GTK_CONTAINER (retval), frame);
	gtk_widget_show (frame);

	vbox = gtk_vbox_new (FALSE, 0);
	gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
	gtk_container_add (GTK_CONTAINER (frame), vbox);
	gtk_widget_show (vbox);

	image = gtk_image_new_from_icon_name (PANEL_ICON_FORCE_QUIT,
					      GTK_ICON_SIZE_DIALOG);
	gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.5);
	gtk_box_pack_start (GTK_BOX (vbox), image, TRUE, TRUE, 4);
	gtk_widget_show (image);

	label = gtk_label_new (_("Click on a window to force the application to quit. "
				 "To cancel press <ESC>."));
	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
	gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 4);
	gtk_widget_show (label);

	gtk_widget_realize (retval);

	screen_width  = gdk_screen_get_width  (screen);
	screen_height = gdk_screen_get_height (screen);

	gtk_widget_get_allocation (retval, &allocation);

	gtk_window_move (GTK_WINDOW (retval),
			 (screen_width  - allocation.width) / 2,
			 (screen_height - allocation.height) / 2);

	gtk_widget_show (GTK_WIDGET (retval));

	return retval;
}
Exemplo n.º 13
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;
}
CDListing *cd_do_create_listing (void)
{
	CDListing *pListing = g_new0 (CDListing, 1);
	
	pListing->container.iType = CAIRO_DOCK_NB_CONTAINER_TYPES+1;
	pListing->container.bIsHorizontal = TRUE;
	pListing->container.bDirectionUp = TRUE;
	pListing->container.fRatio = 1.;
	
	GtkWidget *pWindow = cairo_dock_create_container_window_no_opengl ();
	gtk_window_set_title (GTK_WINDOW (pWindow), "cairo-dock-listing");
	//gtk_widget_add_events (pWindow, GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
	g_signal_connect (G_OBJECT (pWindow),
		"expose-event",
		G_CALLBACK (on_expose_listing),
		pListing);
	g_signal_connect (G_OBJECT (pWindow),
		"configure-event",
		G_CALLBACK (on_configure_listing),
		pListing);
	g_signal_connect (G_OBJECT (pWindow),
		"key-press-event",
		G_CALLBACK (on_key_press_listing),
		pListing);
	/*g_signal_connect (G_OBJECT (pWindow),
		"motion-notify-event",
		G_CALLBACK (on_motion_notify_listing),
		pListing);
	g_signal_connect (G_OBJECT (pWindow),
		"button-press-event",
		G_CALLBACK (on_button_press_listing),
		pListing);
	g_signal_connect (G_OBJECT (pWindow),
		"scroll-event",
		G_CALLBACK (on_scroll_listing),
		pListing);*/
	pListing->container.pWidget = pWindow;
	
	gtk_widget_show_all (pWindow);
	gtk_window_stick (GTK_WINDOW (pWindow));
	gtk_window_set_keep_above (GTK_WINDOW (pWindow), TRUE);
	
	pListing->container.iWidth = _listing_compute_width (pListing);
	pListing->container.iHeight = _listing_compute_height (pListing);
	gtk_window_resize (GTK_WINDOW (pWindow),
		pListing->container.iWidth,
		pListing->container.iHeight);
	
	_place_listing (pListing);
	
	return pListing;
}
Exemplo n.º 15
0
static gboolean
ah_state_visible(panel *p)
{
    ENTER;
    if (p->ah_state != ah_state_visible) {
        p->ah_state = ah_state_visible;
        gtk_widget_show(p->topgwin);
        gtk_window_stick(GTK_WINDOW(p->topgwin));
    } else if (p->ah_far) {
        ah_state_waiting(p);
    }
    RET(FALSE);
}
Exemplo n.º 16
0
/*
 Creates main window
*/
void
launcher_create_window (launcher_core_s *launcher_core)
{
	launcher_core->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size (GTK_WINDOW(launcher_core->window), launcher_core->width, launcher_core->height);
	gtk_window_set_resizable (GTK_WINDOW(launcher_core->window), TRUE);
	gtk_widget_set_app_paintable (launcher_core->window, TRUE);
	gtk_window_set_decorated (GTK_WINDOW(launcher_core->window), FALSE);
	on_alpha_screen_changed (launcher_core->window, NULL, NULL);
	gtk_window_stick (GTK_WINDOW(launcher_core->window));
	gtk_window_set_keep_below (GTK_WINDOW(launcher_core->window), TRUE);
	gtk_window_set_modal (GTK_WINDOW(launcher_core->window), FALSE);
	gtk_window_set_type_hint (GTK_WINDOW(launcher_core->window), GDK_WINDOW_TYPE_HINT_DOCK);
}
Exemplo n.º 17
0
/* At some point subclass GtkWindow instead. */
static void
on_realize(GtkWidget *win, gpointer data) {
	guint width;
	GtkAllocation allocation;
	gtk_widget_get_allocation(win, &allocation);
	width = gdk_screen_width();
	gtk_window_set_decorated (GTK_WINDOW (win), FALSE);
	set_strut(GTK_WINDOW(win), width, 0, allocation.height, allocation.height, 0, width);
	// We don't care about showing the panel on all desktops just yet.
	gtk_window_stick (GTK_WINDOW (win));
	gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_DOCK);
	gdk_window_set_geometry_hints (gtk_widget_get_window(win), NULL, GDK_HINT_POS);
	gdk_window_move_resize(gtk_widget_get_window(win), 0, 0, width, allocation.height);
	gtk_window_set_has_resize_grip(GTK_WINDOW(win), FALSE);
}
Exemplo n.º 18
0
int lassi_osd_init(LassiOsdInfo *osd) {
    GtkWidget *hbox;

    g_assert(osd);

    memset(osd, 0, sizeof(*osd));

    osd->window = gtk_window_new(GTK_WINDOW_POPUP);
    gtk_window_set_title(GTK_WINDOW(osd->window), "Mango Lassi OSD");
    gtk_window_stick(GTK_WINDOW(osd->window));
    gtk_window_set_keep_above(GTK_WINDOW(osd->window), TRUE);
    gtk_window_set_decorated(GTK_WINDOW(osd->window), FALSE);
    gtk_window_set_deletable(GTK_WINDOW(osd->window), FALSE);
    gtk_window_set_type_hint(GTK_WINDOW(osd->window), GDK_WINDOW_TYPE_HINT_NOTIFICATION);
    gtk_window_set_skip_taskbar_hint(GTK_WINDOW(osd->window), TRUE);
    gtk_window_set_skip_pager_hint(GTK_WINDOW(osd->window), TRUE);
    gtk_window_set_accept_focus(GTK_WINDOW(osd->window), FALSE);
    gtk_window_set_focus_on_map(GTK_WINDOW(osd->window), FALSE);
    gtk_window_set_gravity(GTK_WINDOW(osd->window), GDK_GRAVITY_SOUTH_WEST);
    gtk_widget_set_app_paintable(GTK_WIDGET(osd->window), TRUE);
    g_signal_connect(osd->window, "draw", G_CALLBACK(draw_cb), NULL);

    osd->label = gtk_label_new("Test");
    gtk_misc_set_padding(GTK_MISC(osd->label), 16, 0);
/*     gtk_label_set_line_wrap(GTK_LABEL(osd->label), TRUE);  */
    osd->left_icon = gtk_image_new();
    osd->right_icon = gtk_image_new();

    hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
    gtk_container_set_border_width(GTK_CONTAINER(hbox), 8);

    gtk_box_pack_start(GTK_BOX(hbox), osd->left_icon, FALSE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), osd->label, TRUE, TRUE, 0);
    gtk_box_pack_end(GTK_BOX(hbox), osd->right_icon, FALSE, TRUE, 0);

    gtk_container_add(GTK_CONTAINER(osd->window), hbox);

    gtk_widget_show(hbox);
    gtk_widget_show(osd->label);

    gtk_widget_realize(GTK_WIDGET(osd->window));

    /*g_debug("WINDOW=%p", osd->window);*/

    return 0;
}
Exemplo n.º 19
0
static void
hippo_window_gtk_init(HippoWindowGtk *window_gtk)
{
    window_gtk->app_window = TRUE;

    gtk_window_set_resizable(GTK_WINDOW(window_gtk), FALSE);
    gtk_window_set_decorated(GTK_WINDOW(window_gtk), FALSE);
    gtk_window_stick(GTK_WINDOW(window_gtk));

    window_gtk->hresizable = FALSE;
    window_gtk->vresizable = FALSE;
    window_gtk->resize_gravity = HIPPO_GRAVITY_NORTH_WEST;

    gtk_widget_add_events(GTK_WIDGET(window_gtk), GDK_VISIBILITY_NOTIFY_MASK);

    /* See note about double buffering in hippo_window_gtk_expose_event */
    gtk_widget_set_double_buffered(GTK_WIDGET(window_gtk), FALSE);
}
Exemplo n.º 20
0
JNIEXPORT void JNICALL
Java_org_gnome_gtk_GtkWindow_gtk_1window_1stick
(
	JNIEnv* env,
	jclass cls,
	jlong _self
)
{
	GtkWindow* self;

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

	// call function
	gtk_window_stick(self);

	// cleanup parameter self
}
Exemplo n.º 21
0
void WXAppBar::SetSticky (bool stick)
{
#if defined(__WXMSW__)
	// TODO
	(void)(stick); // Remove warning
	//assert (false);
#elif defined(__WXGTK__)	
	// Get X11 handle for our window
	GtkWindow *gtkWindow= (GtkWindow *) GetHandle();
	assert (gtkWindow);
	if (!gtkWindow) return;

	if (stick) 
		gtk_window_stick (gtkWindow);
	else 
		gtk_window_unstick (gtkWindow);	
#else
	assert (false);
#endif
}
Exemplo n.º 22
0
static GtkWidget *
volume_create_slider(volume_priv *c)
{
    GtkWidget *slider, *win;
    GtkWidget *frame;
    
    win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size(GTK_WINDOW(win), 180, 180);
    gtk_window_set_decorated(GTK_WINDOW(win), FALSE);
    gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
    gtk_container_set_border_width(GTK_CONTAINER(win), 1);
    gtk_window_set_skip_taskbar_hint(GTK_WINDOW(win), TRUE);
    gtk_window_set_skip_pager_hint(GTK_WINDOW(win), TRUE);
    gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_MOUSE);
    gtk_window_stick(GTK_WINDOW(win));

    frame = gtk_frame_new(NULL);
    gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
    gtk_container_add(GTK_CONTAINER(win), frame);
    gtk_container_set_border_width(GTK_CONTAINER(frame), 1);
    
    slider = gtk_vscale_new_with_range(0.0, 100.0, 1.0);
    gtk_widget_set_size_request(slider, 25, 82);
    gtk_scale_set_draw_value(GTK_SCALE(slider), TRUE);
    gtk_scale_set_value_pos(GTK_SCALE(slider), GTK_POS_BOTTOM);
    gtk_scale_set_digits(GTK_SCALE(slider), 0);
    gtk_range_set_inverted(GTK_RANGE(slider), TRUE);
    gtk_range_set_value(GTK_RANGE(slider), ((meter_priv *) c)->level);
    DBG("meter->level %f\n", ((meter_priv *) c)->level);
    g_signal_connect(G_OBJECT(slider), "value_changed",
        G_CALLBACK(slider_changed), c);
    g_signal_connect(G_OBJECT(slider), "enter-notify-event",
        G_CALLBACK(crossed), (gpointer)c);
    g_signal_connect(G_OBJECT(slider), "leave-notify-event",
        G_CALLBACK(crossed), (gpointer)c);
    gtk_container_add(GTK_CONTAINER(frame), slider);
    
    c->slider = slider;
    return win;
}  
Exemplo n.º 23
0
/*
 Creates the main window, setting size and position
*/
static void
libgadget_sidebar_create_sidebar (sidebar_core_s *core)
{
	/* Create a new window and set all its proprieties */
	core->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size (GTK_WINDOW(core->window), core->width, core->height);
	gtk_widget_set_uposition (GTK_WIDGET(core->window), (core->width_desktop - core->width), 0);
	
	/* Set widget's name */
	gtk_widget_set_name (core->window, "main_window");
	
	gtk_window_set_resizable (GTK_WINDOW(core->window), FALSE);
	gtk_widget_set_app_paintable (core->window, TRUE);
	gtk_window_set_decorated (GTK_WINDOW(core->window), FALSE);
	on_alpha_screen_changed (core->window, NULL, NULL);
	
	gtk_window_stick (GTK_WINDOW(core->window));
	gtk_window_set_keep_below (GTK_WINDOW(core->window), TRUE);
	gtk_window_set_modal (GTK_WINDOW(core->window), FALSE);
	gtk_window_set_type_hint (GTK_WINDOW(core->window), GDK_WINDOW_TYPE_HINT_DOCK);

}
static void
gsm_logout_dialog_init (GsmLogoutDialog *logout_dialog)
{
    logout_dialog->priv = GSM_LOGOUT_DIALOG_GET_PRIVATE (logout_dialog);

    logout_dialog->priv->timeout_id = 0;
    logout_dialog->priv->timeout = 0;
    logout_dialog->priv->default_response = GTK_RESPONSE_CANCEL;
    logout_dialog->priv->info_label = NULL;

    gtk_window_set_resizable (GTK_WINDOW (logout_dialog), FALSE);
    gtk_dialog_set_has_separator (GTK_DIALOG (logout_dialog), FALSE);
    gtk_window_set_keep_above (GTK_WINDOW (logout_dialog), TRUE);
    gtk_window_stick (GTK_WINDOW (logout_dialog));

    /* use HIG spacings */
    gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (logout_dialog)->vbox), 12);
    gtk_container_set_border_width (GTK_CONTAINER (logout_dialog), 6);

    gtk_dialog_add_button (GTK_DIALOG (logout_dialog), GTK_STOCK_HELP,
                           GTK_RESPONSE_HELP);
    logout_dialog->priv->cancel_button =
        gtk_dialog_add_button (GTK_DIALOG (logout_dialog),
                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);

    logout_dialog->priv->up_client = up_client_new ();

    logout_dialog->priv->consolekit = gsm_get_consolekit ();

    g_signal_connect (logout_dialog,
                      "destroy",
                      G_CALLBACK (gsm_logout_dialog_destroy),
                      NULL);

    g_signal_connect (logout_dialog,
                      "show",
                      G_CALLBACK (gsm_logout_dialog_show),
                      NULL);
}
static GList *
create_secondary_break_windows (void)
{
    GdkDisplay *display;
    GdkScreen  *screen;
    GtkWidget  *window;
    gint        i;
    GList      *windows = NULL;

    display = gdk_display_get_default ();

    for (i = 0; i < gdk_display_get_n_screens (display); i++) {
        screen = gdk_display_get_screen (display, i);

        if (screen == gdk_screen_get_default ()) {
            /* Handled by DrwBreakWindow. */
            continue;
        }

        window = gtk_window_new (GTK_WINDOW_POPUP);

        windows = g_list_prepend (windows, window);

        gtk_window_set_screen (GTK_WINDOW (window), screen);

        gtk_window_set_default_size (GTK_WINDOW (window),
                                     gdk_screen_get_width (screen),
                                     gdk_screen_get_height (screen));

        gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
        drw_setup_background (GTK_WIDGET (window));
        gtk_window_stick (GTK_WINDOW (window));
        gtk_widget_show (window);
    }

    return windows;
}
Exemplo n.º 26
0
static GtkWidget *
mca_info_panel_host (GtkWidget *panel)
{
	GtkWidget   *window;

	//host panel inside a normal window
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_container_add (GTK_CONTAINER(window), GTK_WIDGET(panel));

	gtk_window_set_title(GTK_WINDOW (window), "Mkahawa Cyber Client");
	gtk_widget_hide_on_delete(window);
	//gtk_window_set_position(GTK_WINDOW (window), GTK_WIN_POS_NONE);
	gtk_window_stick(GTK_WINDOW (window));
	gtk_window_set_keep_above(GTK_WINDOW (window), TRUE);
	//gtk_window_set_decorated(GTK_WINDOW (window), FALSE);
	gtk_window_set_deletable(GTK_WINDOW (window), FALSE);
	gtk_window_set_resizable(GTK_WINDOW (window), FALSE);

	g_signal_connect (G_OBJECT (window), "destroy", 
										G_CALLBACK (ipnl_destroy), 
										G_OBJECT (window));

	g_signal_connect (G_OBJECT (window), "delete-event", 
										G_CALLBACK (ipnl_delete_event), 
										NULL);
	
	g_signal_connect (G_OBJECT (window), "window-state-event", 
										G_CALLBACK (ipnl_window_state_event), 
										ipnl->tray_icon);
 
	ipnl->wnd_ipnl = window;

	gtk_widget_show_all(window);

	return window;
}
Exemplo n.º 27
0
//Gtk_widget initialization
void gtk_initialize()
{
	int i;
	window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_widget_set_size_request(window,200,75);
	gtk_window_set_opacity(GTK_WINDOW(window),.5);
	//gtk_window_set_modal(GTK_WINDOW(window),FALSE);	
	//gtk_window_set_keep_below(GTK_WINDOW(window),TRUE);
	gtk_window_set_decorated(GTK_WINDOW(window),FALSE);
	gtk_window_set_resizable(GTK_WINDOW(window),FALSE);
	gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window),TRUE);
	gtk_window_stick(GTK_WINDOW(window));
	bg=gtk_image_new_from_file("./images/danger.png");
	power=gtk_image_new();
	gtk_window_move(GTK_WINDOW(window),gdk_screen_width()-200,gdk_screen_height()-200);
	vbox=gtk_vbox_new(0,0);
	layout=gtk_layout_new(NULL,NULL);
	for(i=0;i<2;i++)
	{
		label[i]=gtk_label_new("Initializing..");
	}
	close_event=gtk_event_box_new();
	close_img=gtk_image_new_from_file("./images/close.png");
}
Exemplo n.º 28
0
static void
mpl_panel_gtk_constructed (GObject *self)
{
  MplPanelGtkPrivate *priv = MPL_PANEL_GTK (self)->priv;
  GtkWidget *window;

  if (G_OBJECT_CLASS (mpl_panel_gtk_parent_class)->constructed)
    G_OBJECT_CLASS (mpl_panel_gtk_parent_class)->constructed (self);

  priv->window = window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_name (priv->window, "MplPanelGtk");
  if (!mpl_utils_panel_in_standalone_mode ())
    {
      gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DOCK);
      gtk_window_stick (GTK_WINDOW (window));
    }

  /*
   * Realize the window so we can get the xid.
   */
  gtk_widget_realize (window);

  g_object_set (self, "xid", GDK_WINDOW_XID (gtk_widget_get_window (window)), NULL);
}
Exemplo n.º 29
0
void gcb_main()
{

  GtkWidget *hbox,*vbox;
  int i;
#if 1
  if (gcb_enabled==old_gcb_enabled && gcb_position==old_gcb_position && gcb_position_x==old_gcb_position_x
      && gcb_position_y==old_gcb_position_y)
    return;
#endif
  old_gcb_enabled = gcb_enabled;
  old_gcb_position = gcb_position;
  old_gcb_position_x = gcb_position_x;
  old_gcb_position_y = gcb_position_y;

  if (mainwin) {
    gtk_widget_destroy(mainwin);
    mainwin = NULL;
  }
#if 0
  if (button_bar_tips)
    gtk_widget_destroy(button_bar_tips);
#endif
  if (hist_window) {
    gtk_widget_destroy(hist_window);
    hist_window = NULL;
  }

  if (!gcb_enabled)
    return;

//  printf("gcb_position:%d\n", gcb_position);

  static char geo[][2]={{0,0},{'+','-'},{'+','+'},{'-','-'},{'-','+'}};
  g_free(geomstr);
  geomstr = g_strdup_printf("%c%d%c%d",
  geo[gcb_position][0], gcb_position_x, geo[gcb_position][1], gcb_position_y);
  dbg("geomstr %s\n", geomstr);

  if (!buttonArr) {
    buttonArr=(GtkWidget**)g_malloc(gcb_button_n * sizeof(GtkWidget *));
    buttonStr=(gchar**)g_malloc0(gcb_button_n * sizeof(gchar *));
  }

  if (!hist_strArr) {
    hist_strArr=(gchar**)g_malloc0(gcb_history_n * sizeof(gchar *));
    hist_buttonArr=(GtkWidget**)g_malloc(gcb_history_n * sizeof(GtkWidget *));
  }

  mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_has_resize_grip(GTK_WINDOW(mainwin), FALSE);
  gtk_window_set_decorated(GTK_WINDOW(mainwin),FALSE);
  gtk_window_set_focus_on_map (GTK_WINDOW(mainwin), FALSE);

  hist_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_has_resize_grip(GTK_WINDOW(hist_window), FALSE);

  char icon_path[40];
  sys_icon_fname("gcb.png", icon_path);
  GtkWidget *win_icon=gtk_image_new_from_file(icon_path);
  gtk_window_set_icon(GTK_WINDOW(mainwin),
     gtk_image_get_pixbuf(GTK_IMAGE(win_icon)));
  gtk_window_set_icon(GTK_WINDOW(hist_window),
     gtk_image_get_pixbuf(GTK_IMAGE(win_icon)));

  // Under gnome 2.0, the mainwin is not fixed if decorated, annoying
  gtk_window_set_decorated(GTK_WINDOW(hist_window),FALSE);
  gtk_window_set_skip_pager_hint(GTK_WINDOW(hist_window),TRUE);
  gtk_window_set_skip_taskbar_hint(GTK_WINDOW(hist_window),TRUE);
  gtk_window_set_title (GTK_WINDOW (hist_window),"gcb history");

  gtk_window_set_title (GTK_WINDOW(mainwin), "gcb: gtk copy-paste buffer");
  gtk_window_stick(GTK_WINDOW(mainwin));

//  g_signal_connect(G_OBJECT (mainwin),"destroy", G_CALLBACK (do_exit), NULL);
  g_signal_connect(G_OBJECT (hist_window),"delete_event",
    G_CALLBACK (delete_hist_win), NULL);
  g_signal_connect(G_OBJECT (hist_window),"focus-out-event",
    G_CALLBACK (hist_focus_out_callback), NULL);

#if !GTK_CHECK_VERSION(2,12,0)
  button_bar_tips = gtk_tooltips_new ();
#endif

  hbox = gtk_hbox_new (FALSE, 1);
  gtk_container_add (GTK_CONTAINER(mainwin), hbox);

  gtk_window_parse_geometry(GTK_WINDOW(mainwin),geomstr);

  for(i=0;i<gcb_button_n;i++) {
    buttonArr[i] = gtk_button_new_with_label ("---");
//    gtk_container_set_border_width(GTK_CONTAINER(buttonArr[i]),0);
    gtk_box_pack_start (GTK_BOX(hbox), buttonArr[i], TRUE, TRUE, FALSE);
    gtk_widget_show (buttonArr[i]);
    g_signal_connect (G_OBJECT (buttonArr[i]), "button-press-event",
                      G_CALLBACK (get_mouse_button), (gpointer) buttonArr[i]);
#if 0
    g_signal_connect (G_OBJECT (buttonArr[i]), "key-press-event",
                      G_CALLBACK (key_press_event), NULL);
#endif
#if 1
    g_signal_connect (G_OBJECT (buttonArr[i]), "scroll-event",
                      G_CALLBACK (gcb_button_scroll_event), NULL);
#endif
  }

  vbox = gtk_vbox_new (FALSE, 1);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox), GTK_ORIENTATION_VERTICAL);
  gtk_container_add (GTK_CONTAINER(hist_window), vbox);

  for(i=0;i<gcb_history_n;i++) {
    hist_buttonArr[i] = gtk_button_new_with_label ("---");
    gtk_container_set_border_width(GTK_CONTAINER(hist_buttonArr[i]),0);
    gtk_box_pack_start (GTK_BOX(vbox), hist_buttonArr[i], TRUE, TRUE, FALSE);
    gtk_widget_show (hist_buttonArr[i]);
    g_signal_connect (G_OBJECT (hist_buttonArr[i]), "button-press-event",
                      G_CALLBACK (hist_get_mouse_button), (gpointer) hist_buttonArr[i]);
#if 1
    g_signal_connect (G_OBJECT (hist_buttonArr[i]), "key-press-event",
                      G_CALLBACK (hist_key_press_event), NULL);
#endif
  }

#if 1
  // need this because on win32 scoll is not recieved if win is not focused.
  gtk_box_pack_start (GTK_BOX (hbox), gtk_vseparator_new(), FALSE, FALSE, 0);
  GtkWidget *eve_arrow = gtk_event_box_new();
  gtk_event_box_set_visible_window (GTK_EVENT_BOX(eve_arrow), FALSE);
  gtk_box_pack_start (GTK_BOX(hbox), eve_arrow, FALSE, FALSE, FALSE);
    g_signal_connect(G_OBJECT(eve_arrow),"button-press-event", G_CALLBACK(mouse_button_callback), NULL);
  gtk_container_add(GTK_CONTAINER(eve_arrow), gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_IN));
#endif


  gtk_widget_show_all(hbox);
  gtk_widget_show (vbox);
  gtk_widget_show (mainwin);


  pclipboard_prim = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
  pclipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);

  set_snoop_button(buttonArr[0]);
  get_selection(pclipboard);
  get_selection(pclipboard_prim);
  gtk_container_set_border_width(GTK_CONTAINER(hbox),0);
  gtk_container_set_border_width(GTK_CONTAINER(mainwin),0);

  gtk_window_parse_geometry(GTK_WINDOW(mainwin),geomstr);
#if GTK_CHECK_VERSION(2,6,0)
  g_signal_connect(pclipboard, "owner-change", G_CALLBACK (cb_owner_change), NULL);
  g_signal_connect(pclipboard_prim, "owner-change", G_CALLBACK (cb_owner_change), NULL);
#endif
}
Exemplo n.º 30
0
gint
yad_print_run (void)
{
  GtkWidget *dlg;
  GtkWidget *box, *img, *lbl;
  gchar *uri, *job_name = NULL;
  GtkPrintCapabilities pcap;
  GtkPrintOperationAction act = GTK_PRINT_OPERATION_ACTION_PRINT;
  gint resp, ret = 0;
  GError *err = NULL;

  /* check if file is exists */
  if (options.common_data.uri && options.common_data.uri[0])
    {
      if (!g_file_test (options.common_data.uri, G_FILE_TEST_EXISTS))
        {
          g_printerr (_("File %s not found.\n"), options.common_data.uri);
          return 1;
        }
    }
  else
    {
      g_printerr (_("Filename is not specified.\n"));
      return 1;
    }

  /* create print dialog */
  dlg = gtk_print_unix_dialog_new (options.data.dialog_title, NULL);
  gtk_window_set_type_hint (GTK_WINDOW (dlg), GDK_WINDOW_TYPE_HINT_NORMAL);
  gtk_print_unix_dialog_set_embed_page_setup (GTK_PRINT_UNIX_DIALOG (dlg), TRUE);
  pcap = GTK_PRINT_CAPABILITY_PAGE_SET | GTK_PRINT_CAPABILITY_COPIES |
    GTK_PRINT_CAPABILITY_COLLATE | GTK_PRINT_CAPABILITY_REVERSE |
    GTK_PRINT_CAPABILITY_NUMBER_UP | GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT;
  if (options.common_data.preview && options.print_data.type != YAD_PRINT_RAW)
    pcap |= GTK_PRINT_CAPABILITY_PREVIEW;
  gtk_print_unix_dialog_set_manual_capabilities (GTK_PRINT_UNIX_DIALOG (dlg), pcap);

  if (!settings.print_settings)
    settings.print_settings = gtk_print_unix_dialog_get_settings (GTK_PRINT_UNIX_DIALOG (dlg));

  uri = g_build_filename (g_get_current_dir (), "yad.pdf", NULL);
  gtk_print_settings_set (settings.print_settings, "output-uri", g_filename_to_uri (uri, NULL, NULL));
  g_free (uri);

  gtk_print_unix_dialog_set_settings (GTK_PRINT_UNIX_DIALOG (dlg), settings.print_settings);

  if (settings.page_setup)
    gtk_print_unix_dialog_set_page_setup (GTK_PRINT_UNIX_DIALOG (dlg), settings.page_setup);

  /* set window behavior */
  gtk_widget_set_name (dlg, "yad-dialog-window");
  if (options.data.sticky)
    gtk_window_stick (GTK_WINDOW (dlg));
  gtk_window_set_resizable (GTK_WINDOW (dlg), !options.data.fixed);
  gtk_window_set_keep_above (GTK_WINDOW (dlg), options.data.ontop);
  gtk_window_set_decorated (GTK_WINDOW (dlg), !options.data.undecorated);
  gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dlg), options.data.skip_taskbar);
  gtk_window_set_skip_pager_hint (GTK_WINDOW (dlg), options.data.skip_taskbar);

  /* set window size and position */
  if (!options.data.geometry)
    {
      gtk_window_set_default_size (GTK_WINDOW (dlg), options.data.width, options.data.height);
      if (options.data.center)
        gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER);
      else if (options.data.mouse)
        gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
    }
  else
    {
      /* parse geometry, if given. must be after showing widget */
      gtk_widget_realize (dlg);
      gtk_window_parse_geometry (GTK_WINDOW (dlg), options.data.geometry);
    }

  /* create yad's top box */
  if (options.data.dialog_text || options.data.dialog_image)
    {
#if !GTK_CHECK_VERSION(3,0,0)
      box = gtk_hbox_new (FALSE, 0);
#else
      box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
#endif

      if (options.data.dialog_image)
        {
          GdkPixbuf *pb = NULL;

          pb = get_pixbuf (options.data.dialog_image, YAD_BIG_ICON);
          img = gtk_image_new_from_pixbuf (pb);
          if (pb)
            g_object_unref (pb);

          gtk_widget_set_name (img, "yad-dialog-image");
          gtk_box_pack_start (GTK_BOX (box), img, FALSE, FALSE, 2);
        }
      if (options.data.dialog_text)
        {
          gchar *buf = g_strcompress (options.data.dialog_text);

          lbl = gtk_label_new (NULL);
          if (!options.data.no_markup)
            gtk_label_set_markup (GTK_LABEL (lbl), buf);
          else
            gtk_label_set_text (GTK_LABEL (lbl), buf);
          gtk_widget_set_name (lbl, "yad-dialog-label");
          gtk_label_set_selectable (GTK_LABEL (lbl), options.data.selectable_labels);
          gtk_misc_set_alignment (GTK_MISC (lbl), options.data.text_align, 0.5);
          if (options.data.geometry || options.data.width != -1)
            gtk_label_set_line_wrap (GTK_LABEL (lbl), TRUE);
          gtk_box_pack_start (GTK_BOX (box), lbl, TRUE, TRUE, 2);
          g_signal_connect (G_OBJECT (lbl), "size-allocate", G_CALLBACK (size_allocate_cb), NULL);
          g_free (buf);
        }

      /* add tob box to dialog */
      gtk_widget_show_all (box);
      gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), box, TRUE, TRUE, 5);
      gtk_box_reorder_child (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), box, 0);
    }

  do
    {
      resp = gtk_dialog_run (GTK_DIALOG (dlg));
      switch (resp)
        {
        case GTK_RESPONSE_APPLY:   /* ask for preview */
          act = GTK_PRINT_OPERATION_ACTION_PREVIEW;
        case GTK_RESPONSE_OK:      /* run print */
          settings.print_settings = gtk_print_unix_dialog_get_settings (GTK_PRINT_UNIX_DIALOG (dlg));
          settings.page_setup = gtk_print_unix_dialog_get_page_setup (GTK_PRINT_UNIX_DIALOG (dlg));
          job_name = g_strdup_printf ("yad-%s-%d", g_path_get_basename (options.common_data.uri), getpid ());
          if (options.print_data.type != YAD_PRINT_RAW)
            {
              /* print text or image */
              GtkPrintOperation *op = gtk_print_operation_new ();
              gtk_print_operation_set_unit (op, GTK_UNIT_POINTS);
              gtk_print_operation_set_print_settings (op, settings.print_settings);
              gtk_print_operation_set_default_page_setup (op, settings.page_setup);
              gtk_print_operation_set_job_name (op, job_name);

              switch (options.print_data.type)
                {
                case YAD_PRINT_TEXT:
                  g_signal_connect (G_OBJECT (op), "begin-print", G_CALLBACK (begin_print_text), NULL);
                  g_signal_connect (G_OBJECT (op), "draw-page", G_CALLBACK (draw_page_text), NULL);
                  break;
                case YAD_PRINT_IMAGE:
                  gtk_print_operation_set_n_pages (op, 1);
                  g_signal_connect (G_OBJECT (op), "draw-page", G_CALLBACK (draw_page_image), NULL);
                  break;
                default:;
                }

              if (gtk_print_operation_run (op, act, NULL, &err) == GTK_PRINT_OPERATION_RESULT_ERROR)
                {
                  g_printerr (_("Printing failed: %s\n"), err->message);
                  ret = 1;
                }
            }
          else
            {
              /* print raw ps or pdf data */
              GtkPrinter *prnt;
              GtkPrintJob *job;

              prnt = gtk_print_unix_dialog_get_selected_printer (GTK_PRINT_UNIX_DIALOG (dlg));

              if (g_str_has_suffix (options.common_data.uri, ".ps"))
                {
                  if (!gtk_printer_accepts_ps (prnt))
                    {
                      g_printerr (_("Printer doesn't support ps format.\n"));
                      ret = 1;
                    }
                }
              else if (g_str_has_suffix (options.common_data.uri, ".pdf"))
                {
                  if (!gtk_printer_accepts_pdf (prnt))
                    {
                      g_printerr (_("Printer doesn't support pdf format.\n"));
                      ret = 1;
                    }
                }
              else
                {
                  g_printerr (_("This file type is not supported for raw printing.\n"));
                  ret = 1;
                }
              if (ret == 1)
                break;

              job = gtk_print_job_new (job_name, prnt, settings.print_settings, settings.page_setup);
              if (gtk_print_job_set_source_file (job, options.common_data.uri, &err))
                {
                  gtk_print_job_send (job, (GtkPrintJobCompleteFunc) raw_print_done, &ret, NULL);
                  gtk_main ();
                }
              else
                {
                  g_printerr (_("Load source file failed: %s\n"), err->message);
                  ret = 1;
                }
            }
          break;
        default:
          ret = 1;
          break;
        }
    }
  while (resp == GTK_RESPONSE_APPLY);

  gtk_widget_destroy (dlg);
  write_settings ();
  return ret;
}