506
508
gboolean decorations;
507
509
g_object_get (pad->priv->settings, "has-decorations", &decorations, NULL);
509
/* Update pad menu with the new status */
510
GtkWidget *menu_item = g_object_get_data (G_OBJECT (pad->priv->menu), "has-decorations");
511
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), decorations);
514
512
* There are two modes of operation: a normal mode and a 'stealth' mode.
515
513
* If decorations are disabled, we also don't show up in the taskbar or pager.
535
533
gboolean has_toolbar, autohide_toolbar;
536
534
g_object_get (pad->priv->settings, "has-toolbar", &has_toolbar, "autohide-toolbar", &autohide_toolbar, NULL);
538
/* Update pad menu with the new status */
539
GtkWidget *menu_item = g_object_get_data (G_OBJECT (pad->priv->menu), "has-toolbar");
540
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), has_toolbar);
541
menu_item = g_object_get_data (G_OBJECT (pad->priv->menu), "has-autohide-toolbar");
542
gtk_widget_set_sensitive (menu_item, has_toolbar);
544
536
if (has_toolbar && !autohide_toolbar)
545
537
xpad_pad_show_toolbar (pad);
553
545
gboolean autohide_toolbar;
554
546
g_object_get (pad->priv->settings, "autohide-toolbar", &autohide_toolbar, NULL);
556
/* Update pad menu with the new status */
557
GtkWidget *menu_item = g_object_get_data (G_OBJECT (pad->priv->menu), "has-autohide-toolbar");
558
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), autohide_toolbar);
560
548
if (autohide_toolbar)
562
550
/* Likely not to be in pad when turning setting on */
579
567
gboolean has_scrollbar;
580
568
g_object_get (pad->priv->settings, "has-scrollbar", &has_scrollbar, NULL);
582
/* Update pad menu with the new status */
583
GtkWidget *menu_item = g_object_get_data (G_OBJECT (pad->priv->menu), "has-scrollbar");
584
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), has_scrollbar);
586
570
if (has_scrollbar)
587
571
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (pad->priv->scrollbar),
588
572
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
892
876
if (!pad->priv->properties)
895
title = g_strdup_printf (_("'%s' Properties"), gtk_window_get_title (GTK_WINDOW (pad)));
879
title = g_strdup_printf (_("'%s' Layout"), gtk_window_get_title (GTK_WINDOW (pad)));
896
880
gtk_window_set_title (GTK_WINDOW (pad->priv->properties), title);
1304
1288
gtk_widget_override_background_color (pad->priv->textview, GTK_STATE_FLAG_SELECTED, &text_color);
1308
* Find the sticky notes menu setting for this pad (which is on the global default),
1309
* and change its setting to the setting from the info file (pad specific default).
1311
if (GTK_IS_CONTAINER (pad->priv->menu)) {
1313
GList *elem, *children;
1314
children = gtk_container_get_children (GTK_CONTAINER (pad->priv->menu));
1316
for (elem = children; elem; elem = elem->next) {
1317
obj = (GObject *) elem->data;
1319
if (GTK_IS_BIN (obj) && GTK_IS_MENU_ITEM (obj)) {
1320
GList *elem2, *children2;
1321
children2 = gtk_container_get_children (GTK_CONTAINER (gtk_menu_item_get_submenu (GTK_MENU_ITEM(obj))));
1322
for(elem2 = children2; elem2; elem2 = elem2->next) {
1323
obj = (GObject *) elem2->data;
1324
if (GTK_IS_CHECK_MENU_ITEM (obj)) {
1325
if (!g_strcmp0(gtk_menu_item_get_label (GTK_MENU_ITEM (obj)), "Show on _All Workspaces")) {
1326
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (obj), pad->priv->sticky);
1337
g_warning("For some reason the variable pad->priv->menu is not a container. This results in not having a unique sticky setting for this pad. Falling back to the global sticky setting. Please send a bugreport.");
1339
1291
if (pad->priv->sticky)
1340
1292
gtk_window_stick (GTK_WINDOW (pad));
1537
1489
menu_toggle_tag (pad, "strikethrough");
1541
* Make the pad visually stick to the workspace and save this setting to the individual pad info file,
1542
* because this function has been probably been called, because of a menu toggle.
1545
menu_sticky (GtkCheckMenuItem *check, XpadPad *pad)
1547
pad->priv->sticky = gtk_check_menu_item_get_active (check);
1548
if (pad->priv->sticky)
1549
gtk_window_stick (GTK_WINDOW (pad));
1551
gtk_window_unstick (GTK_WINDOW (pad));
1552
xpad_pad_save_info_delayed (pad);
1556
menu_toolbar (GtkCheckMenuItem *check, XpadPad *pad)
1558
g_object_set (pad->priv->settings, "has-toolbar", gtk_check_menu_item_get_active (check), NULL);
1562
menu_scrollbar (GtkCheckMenuItem *check, XpadPad *pad)
1564
g_object_set (pad->priv->settings, "has-scrollbar", gtk_check_menu_item_get_active (check), NULL);
1568
menu_autohide (GtkCheckMenuItem *check, XpadPad *pad)
1570
g_object_set (pad->priv->settings, "autohide-toolbar", gtk_check_menu_item_get_active (check), NULL);
1574
menu_decorated (GtkCheckMenuItem *check, XpadPad *pad)
1576
g_object_set (pad->priv->settings, "has-decorations", gtk_check_menu_item_get_active (check), NULL);
1580
1493
menu_title_compare (GtkWindow *a, GtkWindow *b)
1625
1538
menu_get_popup_no_highlight (XpadPad *pad, GtkAccelGroup *accel_group)
1627
1540
GtkWidget *uppermenu, *menu, *item;
1628
gboolean has_toolbar, autohide_toolbar, has_scrollbar, decorations;
1630
g_object_get (pad->priv->settings,
1631
"has-toolbar", &has_toolbar,
1632
"autohide-toolbar", &autohide_toolbar,
1633
"has-decorations", &decorations,
1634
"has-scrollbar", &has_scrollbar, NULL);
1636
1543
uppermenu = gtk_menu_new ();
1637
1544
gtk_menu_set_accel_group (GTK_MENU (uppermenu), accel_group);
1640
item = gtk_menu_item_new_with_mnemonic (_("_Pad"));
1641
gtk_container_add (GTK_CONTAINER (uppermenu), item);
1642
menu = gtk_menu_new ();
1643
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
1644
1546
MENU_ADD (_("_New"), "document-new", GDK_KEY_N, GDK_CONTROL_MASK, xpad_pad_spawn);
1646
MENU_ADD_CHECK (_("Show on _All Workspaces"), pad->priv->sticky, menu_sticky);
1647
g_object_set_data (G_OBJECT (uppermenu), "sticky", item);
1648
MENU_ADD (_("_Properties"), "document-properties", 0, 0, xpad_pad_open_properties);
1547
MENU_ADD (_("_Delete"), "edit-delete", GDK_KEY_Delete, GDK_SHIFT_MASK, xpad_pad_delete);
1650
1548
MENU_ADD (_("_Close"), "window-close", 0, 0, xpad_pad_close);
1651
MENU_ADD (_("_Delete"), "edit-delete", GDK_KEY_Delete, GDK_SHIFT_MASK, xpad_pad_delete);
1653
1550
/* Edit submenu */
1654
1551
item = gtk_menu_item_new_with_mnemonic (_("_Edit"));
1662
1559
MENU_ADD_SEP();
1663
1560
MENU_ADD (_("_Paste"), "edit-paste", 0, 0, xpad_pad_paste);
1664
1561
g_object_set_data (G_OBJECT (uppermenu), "paste", item);
1666
MENU_ADD (_("_Preferences"), "preferences-system", 0, 0, xpad_pad_open_preferences);
1563
MENU_ADD (_("_Layout"), "document-properties", 0, 0, xpad_pad_open_properties);
1669
item = gtk_menu_item_new_with_mnemonic (_("_View"));
1670
gtk_container_add (GTK_CONTAINER (uppermenu), item);
1671
menu = gtk_menu_new ();
1672
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
1673
MENU_ADD_CHECK (_("_Toolbar"), has_toolbar, menu_toolbar);
1674
g_object_set_data (G_OBJECT (uppermenu), "has-toolbar", item);
1675
MENU_ADD_CHECK (_("_Autohide Toolbar"), autohide_toolbar, menu_autohide);
1676
g_object_set_data (G_OBJECT (uppermenu), "has-autohide-toolbar", item);
1677
gtk_widget_set_sensitive (item, has_toolbar);
1678
MENU_ADD_CHECK (_("_Scrollbar"), has_scrollbar, menu_scrollbar);
1679
g_object_set_data (G_OBJECT (uppermenu), "has-scrollbar", item);
1680
MENU_ADD_CHECK (_("_Window Decorations"), decorations, menu_decorated);
1681
g_object_set_data (G_OBJECT (uppermenu), "has-decorations", item);
1683
1568
/* Notes submenu - The list of notes will get added in the prep function below */
1684
1569
item = gtk_menu_item_new_with_mnemonic (_("_Notes"));
1697
1582
MENU_ADD (_("_Help"), "help-browser", GDK_KEY_F1, 0, show_help);
1698
1583
MENU_ADD (_("_About"), "help-about", 0, 0, menu_about);
1588
MENU_ADD (_("_Preferences"), "preferences-system", 0, 0, xpad_pad_open_preferences);
1700
1590
gtk_widget_show_all (uppermenu);
1702
1592
return uppermenu;