25 Commits
2.0.2 ... 2.2.0

Author SHA1 Message Date
Clement Lefebvre
cd94beb376 2.2.0 2019-06-29 17:24:07 +02:00
Clement Lefebvre
350e3ffc29 l10n: Update POT 2019-06-23 14:24:25 +02:00
Stephen Collins
52ee1591f7 Prevent a warning when closing the window while print preview is open (#315)
The warning was caused by the preview trying to save print settings
after the settings object was cleared. Clearing the settings object
in *_finalize instead of *_dispose fixes the issue.
2019-06-23 14:23:08 +02:00
Leigh Scott
db60af5efb Add minimum required version for xapp (#313)
closes #312
2019-06-23 14:22:46 +02:00
Stephen Collins
dde92eecbf Simplify an if statement. The logic is identical, but easier to read (#314) 2019-06-20 09:29:36 -07:00
Stephen Collins
7bdc217e8c Tab width popup: only select a menu item when the menu is open (#311)
This fixes a gdk window assertion error that occurs every time xed
is opened, as well as causes the correct menu item to actually be
selected as expected (it currently isn't).
2019-06-15 01:21:57 -07:00
Stephen Collins
2520d1c087 Remove deprecated call to gtk_widget_override_background_color (#299)
This was an override that no longer seems necessary and is causing
deprecation warnings.
2019-05-13 00:32:52 -07:00
Stephen Collins
116bfc2ac1 Remove references to deprecated GTK_STOCK_* (#298) 2019-05-13 00:32:34 -07:00
Stephen Collins
1820d0db69 Switch deprecated gtk_icon_info_free to g_object_unref (#301) 2019-05-13 00:23:40 -07:00
Stephen Collins
17062aaa18 Fix stuttering and disappearing of the toolbar when fullscreen (#300)
This fixes an issue where moving the mouse along the top edge of the
screen while fullscreened will cause a leave event to be triggered,
even though the mouse pointer is still inside the event box. This
caused the toolbar to disappear and/or stutter while moving the mouse
along the top edge.
2019-05-13 00:23:03 -07:00
Stephen Collins
aa7dabad39 Search: replace a few functions that were deprecated in Gtk 3.22 (#297)
gtk_source_search_context_forward_finish,
gtk_source_search_context_backward_finish, and
gtk_source_search_context_replace
were replaced with
gtk_source_search_context_forward_finish2,
gtk_source_search_context_backward_finish2, and
gtk_source_search_context_replace2
respectively.
2019-05-08 02:34:06 -07:00
Stephen Collins
15ec9b4e65 Print preview: remove a couple calls to gtk_adjustment_value_changed (#296)
This function is no longer needed as the "value-changed" signal is
automatically emitted whenever the value changes (since Gtk 3.18).
2019-05-08 02:29:29 -07:00
Stephen Collins
612f36cea9 Replace deprecated gdk_cursor_new with gdk_cursor_new_for_display (#295)
Also fix a potential memory leak/segfault in the filebrowser plugin.
2019-05-08 02:17:45 -07:00
Stephen Collins
e7328ad12e print job: replace some deprecated font button functions (#294)
Replaces gtk_font_button_*et_font_name with gtk_font_chooser_*et_font
2019-05-08 02:08:22 -07:00
Clement Lefebvre
172f323b4b l10n: Update POT 2019-05-05 17:33:18 +01:00
Stephen Collins
4044529191 Add toggle comment and toggle comment block actions w/ keybindings (#290) 2019-05-05 10:27:11 +01:00
Stephen Collins
992ca7a3ec print preview: fix logic for forward button sensitivity (#292)
Previously, the logic used to set the sensitivity of the forward
navigation button failed to consider when multiple pages are shown.
This resulted in the forward button being sensitive in some cases,
even if all pages, or the last page were shown. With this commit, it
is now updated properly.

Also, when the rows and columns are changed, the current page is now
changed to the nearest multiple of rows*cols so that the current page
is still shown, but navigating back to the beginning and then forward
again will be consistent.
2019-05-05 10:26:58 +01:00
Stephen Collins
67892da099 Fix some deprecation warnings (#289)
* xed-app.c: replace get_active_window with gtk_application version

This allows us to remove quite a bit of code, some of which uses
deprecated functions, so it also has the benefit of cleaning up the
deprecation warnings a bit.

* Switch a couple uses of gtk_show_uri with gtk_show_uri_on_window

gtk_show_uri is deprecated.

* Taglist plugin: remove call to gtk_tree_view_set_rules_hint

This function is deprecated, and it already defaults to false in
any case, so it wasn't doing anything anyway.

* Deprecations: move all instances of gtk_menu_popup to newer methods

In a couple cases this simplifies the code quite a bit

* Replace deprecated gdk_window_at_pointer with newer method
2019-05-05 10:25:37 +01:00
JosephMcc
2ebff67c9c xed-notebook: Always show the main notebook tabs (#285)
We were only showing the tabs when more than one file was open. When
fullscreen this leaves no indication of the current file having been modified
if there is only one. Instead just set them to show at all times.

Closes: https://github.com/linuxmint/xed/issues/152
2019-05-05 10:21:18 +01:00
JosephMcc
43ee0436d8 xed-window: Fix the tabs/spaces label in the statusbar (#283)
This was broken in the commit that added the new highlight mode selection
dialog. Get it working again.
2019-05-05 10:20:53 +01:00
Stephen Collins
fb0002bdcd Filebrowser: Kill the click policy property with fire (#293)
This is left over code from the gedit days, which we don't use, and
don't use. This also has the added benifit of removing at least 1
deprecation warning.
2019-05-05 10:20:18 +01:00
Stephen Collins
2e3f337e84 print preview: fix layout drawing for 1X2 and 2X1 layouts (#291)
The indices were backwards, which was causing incorrect layout, and
scrolling issues at larger zoom levels.
2019-05-03 16:19:49 +01:00
JosephMcc
d208cae3bc cleanup: Remove an unused Makefile.am (#280)
We build with Meson now so don't need this
2019-03-25 15:35:46 +00:00
JosephMcc
05b68fb5f5 statusbar: Fix the menu button styling (#281)
This was broken in 7ce2a750db (diff-d114482c8758b92b9c56c95d18efe926)
2019-03-25 15:35:26 +00:00
Eli Schwartz
42da8bc289 meson: require itstool command to be available (#266)
This is needed in order to run meson's gnome.yelp() helper when
installing the help data.
2019-02-08 10:19:11 +00:00
30 changed files with 523 additions and 1034 deletions

48
debian/changelog vendored
View File

@@ -1,3 +1,51 @@
xed (2.2.0) tina; urgency=medium
[ Eli Schwartz ]
* meson: require itstool command to be available (#266)
[ JosephMcc ]
* statusbar: Fix the menu button styling (#281)
* cleanup: Remove an unused Makefile.am (#280)
[ Stephen Collins ]
* print preview: fix layout drawing for 1X2 and 2X1 layouts (#291)
* Filebrowser: Kill the click policy property with fire (#293)
[ JosephMcc ]
* xed-window: Fix the tabs/spaces label in the statusbar (#283)
* xed-notebook: Always show the main notebook tabs (#285)
[ Stephen Collins ]
* Fix some deprecation warnings (#289)
* print preview: fix logic for forward button sensitivity (#292)
* Add toggle comment and toggle comment block actions w/ keybindings (#290)
[ Clement Lefebvre ]
* l10n: Update POT
[ Stephen Collins ]
* print job: replace some deprecated font button functions (#294)
* Replace deprecated gdk_cursor_new with gdk_cursor_new_for_display (#295)
* Print preview: remove a couple calls to gtk_adjustment_value_changed (#296)
* Search: replace a few functions that were deprecated in Gtk 3.22 (#297)
* Fix stuttering and disappearing of the toolbar when fullscreen (#300)
* Switch deprecated gtk_icon_info_free to g_object_unref (#301)
* Remove references to deprecated GTK_STOCK_* (#298)
* Remove deprecated call to gtk_widget_override_background_color (#299)
* Tab width popup: only select a menu item when the menu is open (#311)
* Simplify an if statement. The logic is identical, but easier to read (#314)
[ Leigh Scott ]
* Add minimum required version for xapp (#313)
[ Stephen Collins ]
* Prevent a warning when closing the window while print preview is open (#315)
[ Clement Lefebvre ]
* l10n: Update POT
-- Clement Lefebvre <root@linuxmint.com> Sat, 29 Jun 2019 17:23:48 +0200
xed (2.0.2) tessa; urgency=medium xed (2.0.2) tessa; urgency=medium
[ Clement Lefebvre ] [ Clement Lefebvre ]

View File

@@ -458,8 +458,6 @@ xed_help_display
GBOOLEAN_TO_POINTER GBOOLEAN_TO_POINTER
GPOINTER_TO_BOOLEAN GPOINTER_TO_BOOLEAN
IS_VALID_BOOLEAN IS_VALID_BOOLEAN
xed_utils_menu_position_under_widget
xed_utils_menu_position_under_tree_view
xed_gtk_button_new_with_stock_icon xed_gtk_button_new_with_stock_icon
xed_dialog_add_button xed_dialog_add_button
xed_utils_escape_underscores xed_utils_escape_underscores
@@ -474,8 +472,6 @@ xed_warning
xed_utils_make_valid_utf8 xed_utils_make_valid_utf8
xed_utils_uri_get_dirname xed_utils_uri_get_dirname
xed_utils_replace_home_dir_with_tilde xed_utils_replace_home_dir_with_tilde
xed_utils_get_current_workspace
xed_utils_get_window_workspace
xed_utils_activate_url xed_utils_activate_url
xed_utils_is_valid_uri xed_utils_is_valid_uri
xed_utils_get_glade_widgets xed_utils_get_glade_widgets

View File

@@ -1,4 +1,4 @@
project('xed', 'c', version : '2.0.2') project('xed', 'c', version : '2.2.0')
gnome = import('gnome') gnome = import('gnome')
i18n = import('i18n') i18n = import('i18n')
@@ -33,7 +33,7 @@ libpeas = dependency('libpeas-1.0', version: '>= 1.12.0')
libpeas_gtk = dependency('libpeas-gtk-1.0', version: '>= 1.12.0') libpeas_gtk = dependency('libpeas-gtk-1.0', version: '>= 1.12.0')
gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required: false) gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required: false)
gmodule = dependency('gmodule-2.0') gmodule = dependency('gmodule-2.0')
xapp = dependency('xapp') xapp = dependency('xapp', version: '>= 1.4.0')
X11 = dependency('x11') X11 = dependency('x11')
pango = dependency('pango') pango = dependency('pango')
@@ -55,6 +55,7 @@ cc = meson.get_compiler('c')
math = cc.find_library('m', required: false) math = cc.find_library('m', required: false)
intltool_merge = find_program('intltool-merge') intltool_merge = find_program('intltool-merge')
itstool = find_program('itstool')
# generate config.h # generate config.h
config_h_file = configure_file( config_h_file = configure_file(

View File

@@ -91,7 +91,7 @@ xed_file_browser_utils_pixbuf_from_icon (GIcon *icon,
} }
ret = gtk_icon_info_load_icon (info, NULL); ret = gtk_icon_info_load_icon (info, NULL);
gtk_icon_info_free (info); g_object_unref (info);
return ret; return ret;
} }

View File

@@ -44,8 +44,6 @@ struct _XedFileBrowserViewPrivate
GtkTreeModel *model; GtkTreeModel *model;
GtkTreeRowReference *editable; GtkTreeRowReference *editable;
/* CLick policy */
XedFileBrowserViewClickPolicy click_policy;
GtkTreePath *double_click_path[2]; /* Both clicks in a double click need to be on the same row */ GtkTreePath *double_click_path[2]; /* Both clicks in a double click need to be on the same row */
GtkTreePath *hover_path; GtkTreePath *hover_path;
GdkCursor *hand_cursor; GdkCursor *hand_cursor;
@@ -64,7 +62,6 @@ enum
{ {
PROP_0, PROP_0,
PROP_CLICK_POLICY,
PROP_RESTORE_EXPAND_STATE PROP_RESTORE_EXPAND_STATE
}; };
@@ -227,139 +224,6 @@ row_collapsed (GtkTreeView *tree_view,
_xed_file_browser_store_iter_collapsed (XED_FILE_BROWSER_STORE (view->priv->model), iter); _xed_file_browser_store_iter_collapsed (XED_FILE_BROWSER_STORE (view->priv->model), iter);
} }
static gboolean
leave_notify_event (GtkWidget *widget,
GdkEventCrossing *event)
{
XedFileBrowserView *view = XED_FILE_BROWSER_VIEW (widget);
if (view->priv->click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE &&
view->priv->hover_path != NULL)
{
gtk_tree_path_free (view->priv->hover_path);
view->priv->hover_path = NULL;
}
// Chainup
return GTK_WIDGET_CLASS (xed_file_browser_view_parent_class)->leave_notify_event (widget, event);
}
static gboolean
enter_notify_event (GtkWidget *widget,
GdkEventCrossing *event)
{
XedFileBrowserView *view = XED_FILE_BROWSER_VIEW (widget);
if (view->priv->click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE)
{
if (view->priv->hover_path != NULL)
{
gtk_tree_path_free (view->priv->hover_path);
}
gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
event->x, event->y,
&view->priv->hover_path,
NULL, NULL, NULL);
if (view->priv->hover_path != NULL)
{
gdk_window_set_cursor (gtk_widget_get_window (widget), view->priv->hand_cursor);
}
}
// Chainup
return GTK_WIDGET_CLASS (xed_file_browser_view_parent_class)->enter_notify_event (widget, event);
}
static gboolean
motion_notify_event (GtkWidget *widget,
GdkEventMotion *event)
{
GtkTreePath *old_hover_path;
XedFileBrowserView *view = XED_FILE_BROWSER_VIEW (widget);
if (view->priv->click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE)
{
old_hover_path = view->priv->hover_path;
gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
event->x, event->y,
&view->priv->hover_path,
NULL, NULL, NULL);
if ((old_hover_path != NULL) != (view->priv->hover_path != NULL))
{
if (view->priv->hover_path != NULL)
{
gdk_window_set_cursor (gtk_widget_get_window (widget), view->priv->hand_cursor);
}
else
{
gdk_window_set_cursor (gtk_widget_get_window (widget), NULL);
}
}
if (old_hover_path != NULL)
{
gtk_tree_path_free (old_hover_path);
}
}
// Chainup
return GTK_WIDGET_CLASS (xed_file_browser_view_parent_class)->motion_notify_event (widget, event);
}
static void
set_click_policy_property (XedFileBrowserView *obj,
XedFileBrowserViewClickPolicy click_policy)
{
GtkTreeIter iter;
GdkDisplay *display;
GdkWindow *win;
obj->priv->click_policy = click_policy;
if (click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE)
{
if (obj->priv->hand_cursor == NULL)
{
obj->priv->hand_cursor = gdk_cursor_new(GDK_HAND2);
}
}
else if (click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE)
{
if (obj->priv->hover_path != NULL)
{
if (gtk_tree_model_get_iter (GTK_TREE_MODEL (obj->priv->model), &iter, obj->priv->hover_path))
{
gtk_tree_model_row_changed (GTK_TREE_MODEL (obj->priv->model), obj->priv->hover_path, &iter);
}
gtk_tree_path_free (obj->priv->hover_path);
obj->priv->hover_path = NULL;
}
if (gtk_widget_get_realized (GTK_WIDGET (obj)))
{
win = gtk_widget_get_window (GTK_WIDGET (obj));
gdk_window_set_cursor (win, NULL);
display = gtk_widget_get_display (GTK_WIDGET (obj));
if (display != NULL)
{
gdk_display_flush (display);
}
}
if (obj->priv->hand_cursor)
{
g_object_unref (obj->priv->hand_cursor);
obj->priv->hand_cursor = NULL;
}
}
}
static void static void
directory_activated (XedFileBrowserView *view, directory_activated (XedFileBrowserView *view,
GtkTreeIter *iter) GtkTreeIter *iter)
@@ -503,14 +367,7 @@ did_not_drag (XedFileBrowserView *view,
if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y, &path, NULL, NULL, NULL)) if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y, &path, NULL, NULL, NULL))
{ {
if ((view->priv->click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE) if ((event->button == 1 || event->button == 2)
&& !button_event_modifies_selection(event)
&& (event->button == 1 || event->button == 2))
{
/* Activate all selected items, and leave them selected */
activate_selected_items (view);
}
else if ((event->button == 1 || event->button == 2)
&& ((event->state & GDK_CONTROL_MASK) != 0 || && ((event->state & GDK_CONTROL_MASK) != 0 ||
(event->state & GDK_SHIFT_MASK) == 0) (event->state & GDK_SHIFT_MASK) == 0)
&& view->priv->selected_on_button_down) && view->priv->selected_on_button_down)
@@ -589,12 +446,6 @@ button_press_event (GtkWidget *widget,
last_click_time = event->time; last_click_time = event->time;
/* Ignore double click if we are in single click mode */
if (view->priv->click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE && click_count >= 2)
{
return TRUE;
}
view->priv->ignore_release = FALSE; view->priv->ignore_release = FALSE;
call_parent = TRUE; call_parent = TRUE;
@@ -654,7 +505,7 @@ button_press_event (GtkWidget *widget,
if (selected) if (selected)
{ {
call_parent = on_expander || gtk_tree_selection_count_selected_rows (selection) == 1; call_parent = on_expander || gtk_tree_selection_count_selected_rows (selection) == 1;
view->priv->ignore_release = call_parent && view->priv->click_policy != XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE; view->priv->ignore_release = call_parent;
} }
else if ((event->state & GDK_CONTROL_MASK) != 0) else if ((event->state & GDK_CONTROL_MASK) != 0)
{ {
@@ -881,9 +732,6 @@ get_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_CLICK_POLICY:
g_value_set_enum (value, obj->priv->click_policy);
break;
case PROP_RESTORE_EXPAND_STATE: case PROP_RESTORE_EXPAND_STATE:
g_value_set_boolean (value, obj->priv->restore_expand_state); g_value_set_boolean (value, obj->priv->restore_expand_state);
break; break;
@@ -903,9 +751,6 @@ set_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_CLICK_POLICY:
set_click_policy_property (obj, g_value_get_enum (value));
break;
case PROP_RESTORE_EXPAND_STATE: case PROP_RESTORE_EXPAND_STATE:
set_restore_expand_state (obj, g_value_get_boolean (value)); set_restore_expand_state (obj, g_value_get_boolean (value));
break; break;
@@ -927,9 +772,6 @@ xed_file_browser_view_class_init (XedFileBrowserViewClass *klass)
object_class->set_property = set_property; object_class->set_property = set_property;
/* Event handlers */ /* Event handlers */
widget_class->motion_notify_event = motion_notify_event;
widget_class->enter_notify_event = enter_notify_event;
widget_class->leave_notify_event = leave_notify_event;
widget_class->button_press_event = button_press_event; widget_class->button_press_event = button_press_event;
widget_class->button_release_event = button_release_event; widget_class->button_release_event = button_release_event;
widget_class->drag_begin = drag_begin; widget_class->drag_begin = drag_begin;
@@ -943,14 +785,6 @@ xed_file_browser_view_class_init (XedFileBrowserViewClass *klass)
/* Default handlers */ /* Default handlers */
klass->directory_activated = directory_activated; klass->directory_activated = directory_activated;
g_object_class_install_property (object_class, PROP_CLICK_POLICY,
g_param_spec_enum ("click-policy",
"Click Policy",
"The click policy",
XED_FILE_BROWSER_TYPE_VIEW_CLICK_POLICY,
XED_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_RESTORE_EXPAND_STATE, g_object_class_install_property (object_class, PROP_RESTORE_EXPAND_STATE,
g_param_spec_boolean ("restore-expand-state", g_param_spec_boolean ("restore-expand-state",
"Restore Expand State", "Restore Expand State",
@@ -1013,14 +847,6 @@ cell_data_cb (GtkTreeViewColumn *tree_column,
path = gtk_tree_model_get_path (tree_model, iter); path = gtk_tree_model_get_path (tree_model, iter);
if (obj->priv->click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE)
{
if (obj->priv->hover_path != NULL && gtk_tree_path_compare (path, obj->priv->hover_path) == 0)
{
underline = PANGO_UNDERLINE_SINGLE;
}
}
if (XED_IS_FILE_BROWSER_STORE (tree_model)) if (XED_IS_FILE_BROWSER_STORE (tree_model))
{ {
if (obj->priv->editable != NULL && gtk_tree_row_reference_valid (obj->priv->editable)) if (obj->priv->editable != NULL && gtk_tree_row_reference_valid (obj->priv->editable))
@@ -1200,17 +1026,6 @@ xed_file_browser_view_start_rename (XedFileBrowserView *tree_view,
FALSE, 0.0, 0.0); FALSE, 0.0, 0.0);
} }
void
xed_file_browser_view_set_click_policy (XedFileBrowserView *tree_view,
XedFileBrowserViewClickPolicy policy)
{
g_return_if_fail (XED_IS_FILE_BROWSER_VIEW (tree_view));
set_click_policy_property (tree_view, policy);
g_object_notify (G_OBJECT (tree_view), "click-policy");
}
void void
xed_file_browser_view_set_restore_expand_state (XedFileBrowserView *tree_view, xed_file_browser_view_set_restore_expand_state (XedFileBrowserView *tree_view,
gboolean restore_expand_state) gboolean restore_expand_state)

View File

@@ -37,12 +37,6 @@ typedef struct _XedFileBrowserView XedFileBrowserView;
typedef struct _XedFileBrowserViewClass XedFileBrowserViewClass; typedef struct _XedFileBrowserViewClass XedFileBrowserViewClass;
typedef struct _XedFileBrowserViewPrivate XedFileBrowserViewPrivate; typedef struct _XedFileBrowserViewPrivate XedFileBrowserViewPrivate;
typedef enum
{
XED_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE,
XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE
} XedFileBrowserViewClickPolicy;
struct _XedFileBrowserView struct _XedFileBrowserView
{ {
GtkTreeView parent; GtkTreeView parent;
@@ -74,8 +68,6 @@ void xed_file_browser_view_set_model (XedFileBrowserView *tree_view,
GtkTreeModel *model); GtkTreeModel *model);
void xed_file_browser_view_start_rename (XedFileBrowserView *tree_view, void xed_file_browser_view_start_rename (XedFileBrowserView *tree_view,
GtkTreeIter *iter); GtkTreeIter *iter);
void xed_file_browser_view_set_click_policy (XedFileBrowserView *tree_view,
XedFileBrowserViewClickPolicy policy);
void xed_file_browser_view_set_restore_expand_state (XedFileBrowserView *tree_view, void xed_file_browser_view_set_restore_expand_state (XedFileBrowserView *tree_view,
gboolean restore_expand_state); gboolean restore_expand_state);

View File

@@ -708,7 +708,7 @@ fill_combo_model (XedFileBrowserWidget *obj)
GtkTreeIter iter; GtkTreeIter iter;
GdkPixbuf *icon; GdkPixbuf *icon;
icon = xed_file_browser_utils_pixbuf_from_theme (GTK_STOCK_HOME, GTK_ICON_SIZE_MENU); icon = xed_file_browser_utils_pixbuf_from_theme ("go-home", GTK_ICON_SIZE_MENU);
gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter, gtk_tree_store_set (store, &iter,
@@ -801,7 +801,7 @@ static const GtkActionEntry tree_actions_sensitive[] =
static const GtkToggleActionEntry tree_actions_toggle[] = static const GtkToggleActionEntry tree_actions_toggle[] =
{ {
{"FilterHidden", GTK_STOCK_DIALOG_AUTHENTICATION, N_("Show _Hidden"), NULL, {"FilterHidden", NULL, N_("Show _Hidden"), NULL,
N_("Show hidden files and folders"), G_CALLBACK (on_action_filter_hidden), FALSE}, N_("Show hidden files and folders"), G_CALLBACK (on_action_filter_hidden), FALSE},
{"FilterBinary", NULL, N_("Show _Binary"), NULL, {"FilterBinary", NULL, N_("Show _Binary"), NULL,
N_("Show binary files"), G_CALLBACK (on_action_filter_binary), FALSE} N_("Show binary files"), G_CALLBACK (on_action_filter_binary), FALSE}
@@ -1183,7 +1183,7 @@ xed_file_browser_widget_init (XedFileBrowserWidget *obj)
gtk_box_set_spacing (GTK_BOX (obj), 3); gtk_box_set_spacing (GTK_BOX (obj), 3);
gtk_orientable_set_orientation (GTK_ORIENTABLE (obj), GTK_ORIENTATION_VERTICAL); gtk_orientable_set_orientation (GTK_ORIENTABLE (obj), GTK_ORIENTATION_VERTICAL);
obj->priv->busy_cursor = gdk_cursor_new (GDK_WATCH); obj->priv->busy_cursor = gdk_cursor_new_for_display (gdk_display_get_default(), GDK_WATCH);
} }
/* Private */ /* Private */
@@ -1247,6 +1247,7 @@ popup_menu (XedFileBrowserWidget *obj,
GtkTreeModel *model) GtkTreeModel *model)
{ {
GtkWidget *menu; GtkWidget *menu;
GtkTreeView *tree;
if (XED_IS_FILE_BROWSER_STORE (model)) if (XED_IS_FILE_BROWSER_STORE (model))
{ {
@@ -1263,16 +1264,18 @@ popup_menu (XedFileBrowserWidget *obj,
g_return_val_if_fail (menu != NULL, FALSE); g_return_val_if_fail (menu != NULL, FALSE);
tree = GTK_TREE_VIEW (obj->priv->treeview);
if (event != NULL) if (event != NULL)
{ {
GtkTreeSelection *selection; GtkTreeSelection *selection;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview)); selection = gtk_tree_view_get_selection (tree);
if (gtk_tree_selection_count_selected_rows (selection) <= 1) if (gtk_tree_selection_count_selected_rows (selection) <= 1)
{ {
GtkTreePath *path; GtkTreePath *path;
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (obj->priv->treeview), if (gtk_tree_view_get_path_at_pos (tree,
(gint)event->x, (gint)event->y, (gint)event->x, (gint)event->y,
&path, NULL, NULL, NULL)) &path, NULL, NULL, NULL))
{ {
@@ -1282,14 +1285,38 @@ popup_menu (XedFileBrowserWidget *obj,
} }
} }
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event->button, event->time); gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
} }
else else
{ {
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, GtkTreeModel *model;
xed_utils_menu_position_under_tree_view, GtkTreeSelection *selection;
obj->priv->treeview, 0, GtkTreeIter iter;
gtk_get_current_event_time ());
model = gtk_tree_view_get_model (tree);
g_return_val_if_fail (model != NULL, FALSE);
selection = gtk_tree_view_get_selection (tree);
g_return_val_if_fail (selection != NULL, FALSE);
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
{
GtkTreePath *path;
GdkRectangle rect;
path = gtk_tree_model_get_path (model, &iter);
gtk_tree_view_get_cell_area (tree, path, gtk_tree_view_get_column (tree, 0), &rect);
gtk_menu_popup_at_rect (GTK_MENU (menu), gtk_widget_get_window (GTK_WIDGET (tree)),
&rect, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL);
gtk_tree_path_free (path);
}
else
{
gtk_menu_popup_at_widget (GTK_MENU (menu), GTK_WIDGET (obj->priv->treeview),
GDK_GRAVITY_SOUTH, GDK_GRAVITY_NORTH, NULL);
}
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE); gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
} }
@@ -1961,11 +1988,7 @@ set_busy (XedFileBrowserWidget *obj,
if (busy) if (busy)
{ {
GdkCursor *cursor; gdk_window_set_cursor (window, obj->priv->busy_cursor);
cursor = gdk_cursor_new (GDK_WATCH);
gdk_window_set_cursor (window, cursor);
g_object_unref (obj->priv->busy_cursor);
} }
else else
{ {
@@ -2329,7 +2352,8 @@ directory_open (XedFileBrowserWidget *obj,
uri = g_file_get_uri (location); uri = g_file_get_uri (location);
if (!gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (obj)), uri, GDK_CURRENT_TIME, &error)) if (!gtk_show_uri_on_window (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (obj))),
uri, GDK_CURRENT_TIME, &error))
{ {
g_signal_emit (obj, signals[ERROR], 0, XED_FILE_BROWSER_ERROR_OPEN_DIRECTORY, error->message); g_signal_emit (obj, signals[ERROR], 0, XED_FILE_BROWSER_ERROR_OPEN_DIRECTORY, error->message);

View File

@@ -712,7 +712,6 @@ xed_taglist_plugin_panel_init (XedTaglistPluginPanel *panel)
panel->priv->tag_groups_combo, panel->priv->tag_groups_combo,
ATK_RELATION_CONTROLLED_BY); ATK_RELATION_CONTROLLED_BY);
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (panel->priv->tags_list), FALSE);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (panel->priv->tags_list), FALSE); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (panel->priv->tags_list), FALSE);
g_object_set (panel->priv->tags_list, "has-tooltip", TRUE, NULL); g_object_set (panel->priv->tags_list, "has-tooltip", TRUE, NULL);

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-12-05 15:16+0000\n" "POT-Creation-Date: 2019-06-23 14:24+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -509,12 +509,12 @@ msgstr ""
msgid "[FILE...] [+LINE]" msgid "[FILE...] [+LINE]"
msgstr "" msgstr ""
#: ../xed/xed-app.c:616 #: ../xed/xed-app.c:529
#, c-format #, c-format
msgid "%s: invalid encoding." msgid "%s: invalid encoding."
msgstr "" msgstr ""
#: ../xed/xed-app.c:1266 #: ../xed/xed-app.c:1180
msgid "There was an error displaying the help." msgid "There was an error displaying the help."
msgstr "" msgstr ""
@@ -667,7 +667,7 @@ msgstr ""
msgid "Do you want to try to replace it with the one you are saving?" msgid "Do you want to try to replace it with the one you are saving?"
msgstr "" msgstr ""
#: ../xed/xed-commands-file.c:503 ../xed/xed-ui.h:118 #: ../xed/xed-commands-file.c:503 ../xed/xed-ui.h:122
msgid "_Replace" msgid "_Replace"
msgstr "" msgstr ""
@@ -764,12 +764,12 @@ msgid "Unsaved Document %d"
msgstr "" msgstr ""
#: ../xed/xed-documents-panel.c:93 ../xed/xed-documents-panel.c:104 #: ../xed/xed-documents-panel.c:93 ../xed/xed-documents-panel.c:104
#: ../xed/xed-window.c:1731 ../xed/xed-window.c:1735 #: ../xed/xed-window.c:1752 ../xed/xed-window.c:1756
msgid "Read-Only" msgid "Read-Only"
msgstr "" msgstr ""
#: ../xed/xed-documents-panel.c:730 ../xed/resources/ui/xed-shortcuts.ui.h:1 #: ../xed/xed-documents-panel.c:717 ../xed/resources/ui/xed-shortcuts.ui.h:1
#: ../xed/xed-window.c:2956 #: ../xed/xed-window.c:2982
msgid "Documents" msgid "Documents"
msgstr "" msgstr ""
@@ -835,7 +835,7 @@ msgstr ""
msgid "Windows" msgid "Windows"
msgstr "" msgstr ""
#: ../xed/xed-highlight-mode-selector.c:269 ../xed/xed-window.c:1849 #: ../xed/xed-highlight-mode-selector.c:291 ../xed/xed-window.c:1868
msgid "Plain Text" msgid "Plain Text"
msgstr "" msgstr ""
@@ -1214,71 +1214,71 @@ msgstr ""
msgid "Preparing..." msgid "Preparing..."
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:567 #: ../xed/xed-print-preview.c:571
msgid "Show the previous page" msgid "Show the previous page"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:573 #: ../xed/xed-print-preview.c:577
msgid "Show the next page" msgid "Show the next page"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:587 #: ../xed/xed-print-preview.c:591
msgid "Current page (Alt+P)" msgid "Current page (Alt+P)"
msgstr "" msgstr ""
#. gtk_label_set_mnemonic_widget ((GtkLabel *) l, mp->priv->page_entry); #. gtk_label_set_mnemonic_widget ((GtkLabel *) l, mp->priv->page_entry);
#. We are displaying 'XXX of XXX'. #. We are displaying 'XXX of XXX'.
#. Translators: the "of" from "1 of 19" in print preview. #. Translators: the "of" from "1 of 19" in print preview.
#: ../xed/xed-print-preview.c:601 #: ../xed/xed-print-preview.c:605
msgid "of" msgid "of"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:606 #: ../xed/xed-print-preview.c:610
msgid "Page total" msgid "Page total"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:607 #: ../xed/xed-print-preview.c:611
msgid "The total number of pages in the document" msgid "The total number of pages in the document"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:627 #: ../xed/xed-print-preview.c:631
msgid "Show multiple pages" msgid "Show multiple pages"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:645 #: ../xed/xed-print-preview.c:649
msgid "Zoom 1:1" msgid "Zoom 1:1"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:651 #: ../xed/xed-print-preview.c:655
msgid "Zoom to fit the whole page" msgid "Zoom to fit the whole page"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:657 #: ../xed/xed-print-preview.c:661
msgid "Zoom the page in" msgid "Zoom the page in"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:663 #: ../xed/xed-print-preview.c:667
msgid "Zoom the page out" msgid "Zoom the page out"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:678 #: ../xed/xed-print-preview.c:682
msgid "_Close preview" msgid "_Close preview"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:680 #: ../xed/xed-print-preview.c:684
msgid "Close print preview" msgid "Close print preview"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:758 #: ../xed/xed-print-preview.c:762
#, c-format #, c-format
msgid "Page %d of %d" msgid "Page %d of %d"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:943 #: ../xed/xed-print-preview.c:944
msgid "Page Preview" msgid "Page Preview"
msgstr "" msgstr ""
#: ../xed/xed-print-preview.c:944 #: ../xed/xed-print-preview.c:945
msgid "The preview of a page in the document to be printed" msgid "The preview of a page in the document to be printed"
msgstr "" msgstr ""
@@ -1700,6 +1700,14 @@ msgstr ""
msgid "Decrement number at cursor" msgid "Decrement number at cursor"
msgstr "" msgstr ""
#: ../xed/resources/ui/xed-shortcuts.ui.h:47
msgid "Toggle comment block"
msgstr ""
#: ../xed/resources/ui/xed-shortcuts.ui.h:48
msgid "Toggle comment"
msgstr ""
#: ../xed/xed-searchbar.c:92 #: ../xed/xed-searchbar.c:92
#, c-format #, c-format
msgid "Found and replaced %d occurrence" msgid "Found and replaced %d occurrence"
@@ -1762,69 +1770,69 @@ msgstr ""
#. Translators: the first %s is a file name (e.g. test.txt) the second one #. Translators: the first %s is a file name (e.g. test.txt) the second one
#. is a directory (e.g. ssh://master.gnome.org/home/users/paolo) #. is a directory (e.g. ssh://master.gnome.org/home/users/paolo)
#: ../xed/xed-tab.c:715 #: ../xed/xed-tab.c:716
#, c-format #, c-format
msgid "Reverting %s from %s" msgid "Reverting %s from %s"
msgstr "" msgstr ""
#: ../xed/xed-tab.c:720 #: ../xed/xed-tab.c:721
#, c-format #, c-format
msgid "Reverting %s" msgid "Reverting %s"
msgstr "" msgstr ""
#. Translators: the first %s is a file name (e.g. test.txt) the second one #. Translators: the first %s is a file name (e.g. test.txt) the second one
#. is a directory (e.g. ssh://master.gnome.org/home/users/paolo) #. is a directory (e.g. ssh://master.gnome.org/home/users/paolo)
#: ../xed/xed-tab.c:733 #: ../xed/xed-tab.c:734
#, c-format #, c-format
msgid "Loading %s from %s" msgid "Loading %s from %s"
msgstr "" msgstr ""
#: ../xed/xed-tab.c:738 #: ../xed/xed-tab.c:739
#, c-format #, c-format
msgid "Loading %s" msgid "Loading %s"
msgstr "" msgstr ""
#. Translators: the first %s is a file name (e.g. test.txt) the second one #. Translators: the first %s is a file name (e.g. test.txt) the second one
#. is a directory (e.g. ssh://master.gnome.org/home/users/paolo) #. is a directory (e.g. ssh://master.gnome.org/home/users/paolo)
#: ../xed/xed-tab.c:819 #: ../xed/xed-tab.c:820
#, c-format #, c-format
msgid "Saving %s to %s" msgid "Saving %s to %s"
msgstr "" msgstr ""
#: ../xed/xed-tab.c:824 #: ../xed/xed-tab.c:825
#, c-format #, c-format
msgid "Saving %s" msgid "Saving %s"
msgstr "" msgstr ""
#. Read only #. Read only
#: ../xed/xed-tab.c:1304 #: ../xed/xed-tab.c:1305
msgid "RO" msgid "RO"
msgstr "" msgstr ""
#: ../xed/xed-tab.c:1352 #: ../xed/xed-tab.c:1353
#, c-format #, c-format
msgid "Error opening file %s" msgid "Error opening file %s"
msgstr "" msgstr ""
#: ../xed/xed-tab.c:1356 #: ../xed/xed-tab.c:1357
#, c-format #, c-format
msgid "Error reverting file %s" msgid "Error reverting file %s"
msgstr "" msgstr ""
#: ../xed/xed-tab.c:1360 #: ../xed/xed-tab.c:1361
#, c-format #, c-format
msgid "Error saving file %s" msgid "Error saving file %s"
msgstr "" msgstr ""
#: ../xed/xed-tab.c:1393 #: ../xed/xed-tab.c:1394
msgid "Name:" msgid "Name:"
msgstr "" msgstr ""
#: ../xed/xed-tab.c:1394 #: ../xed/xed-tab.c:1395
msgid "MIME Type:" msgid "MIME Type:"
msgstr "" msgstr ""
#: ../xed/xed-tab.c:1395 #: ../xed/xed-tab.c:1396
msgid "Encoding:" msgid "Encoding:"
msgstr "" msgstr ""
@@ -1981,8 +1989,8 @@ msgstr ""
msgid "Paste the clipboard" msgid "Paste the clipboard"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:101 ../plugins/filebrowser/xed-file-browser-plugin.c:968 #: ../xed/xed-ui.h:101 ../plugins/filebrowser/xed-file-browser-plugin.c:966
#: ../plugins/filebrowser/xed-file-browser-plugin.c:1003 #: ../plugins/filebrowser/xed-file-browser-plugin.c:1001
#: ../plugins/filebrowser/xed-file-browser-widget.c:760 #: ../plugins/filebrowser/xed-file-browser-widget.c:760
msgid "_Delete" msgid "_Delete"
msgstr "" msgstr ""
@@ -1999,177 +2007,197 @@ msgstr ""
msgid "Select the entire document" msgid "Select the entire document"
msgstr "" msgstr ""
#. View menu #: ../xed/xed-ui.h:105
msgid "_Toggle Comment"
msgstr ""
#: ../xed/xed-ui.h:106 ../plugins/taglist/HTML.tags.xml.in.h:41
msgid "Comment"
msgstr ""
#: ../xed/xed-ui.h:107 #: ../xed/xed-ui.h:107
msgid "_Highlight Mode" msgid "Toggle Comment _Block"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:108 #: ../xed/xed-ui.h:108
msgid "Comment Block"
msgstr ""
#. View menu
#: ../xed/xed-ui.h:111
msgid "_Highlight Mode"
msgstr ""
#: ../xed/xed-ui.h:112
msgid "Change syntax hightlight mode" msgid "Change syntax hightlight mode"
msgstr "" msgstr ""
#. Search menu #. Search menu
#: ../xed/xed-ui.h:112 #: ../xed/xed-ui.h:116
msgid "_Find" msgid "_Find"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:113 #: ../xed/xed-ui.h:117
msgid "Search for text" msgid "Search for text"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:114 #: ../xed/xed-ui.h:118
msgid "Find Ne_xt" msgid "Find Ne_xt"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:115 #: ../xed/xed-ui.h:119
msgid "Search forwards for the same text" msgid "Search forwards for the same text"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:116 #: ../xed/xed-ui.h:120
msgid "Find Pre_vious" msgid "Find Pre_vious"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:117 #: ../xed/xed-ui.h:121
msgid "Search backwards for the same text" msgid "Search backwards for the same text"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:119 #: ../xed/xed-ui.h:123
msgid "Search for and replace text" msgid "Search for and replace text"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:120 #: ../xed/xed-ui.h:124
msgid "Go to _Line..." msgid "Go to _Line..."
msgstr "" msgstr ""
#: ../xed/xed-ui.h:121 #: ../xed/xed-ui.h:125
msgid "Go to a specific line" msgid "Go to a specific line"
msgstr "" msgstr ""
#. Documents menu #. Documents menu
#: ../xed/xed-ui.h:124 #: ../xed/xed-ui.h:128
msgid "_Save All" msgid "_Save All"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:125 #: ../xed/xed-ui.h:129
msgid "Save all open files" msgid "Save all open files"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:126 #: ../xed/xed-ui.h:130
msgid "_Close All" msgid "_Close All"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:127 #: ../xed/xed-ui.h:131
msgid "Close all open files" msgid "Close all open files"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:128 #: ../xed/xed-ui.h:132
msgid "_Previous Document" msgid "_Previous Document"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:129 #: ../xed/xed-ui.h:133
msgid "Activate previous document" msgid "Activate previous document"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:130 #: ../xed/xed-ui.h:134
msgid "_Next Document" msgid "_Next Document"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:131 #: ../xed/xed-ui.h:135
msgid "Activate next document" msgid "Activate next document"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:132 #: ../xed/xed-ui.h:136
msgid "_Move to New Window" msgid "_Move to New Window"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:133 #: ../xed/xed-ui.h:137
msgid "Move the current document to a new window" msgid "Move the current document to a new window"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:139 #: ../xed/xed-ui.h:143
msgid "_Close" msgid "_Close"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:140 #: ../xed/xed-ui.h:144
msgid "Close the current file" msgid "Close the current file"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:146 #: ../xed/xed-ui.h:150
msgid "_Quit" msgid "_Quit"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:147 #: ../xed/xed-ui.h:151
msgid "Quit the program" msgid "Quit the program"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:152 #: ../xed/xed-ui.h:156
msgid "_Toolbar" msgid "_Toolbar"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:153 #: ../xed/xed-ui.h:157
msgid "Show or hide the toolbar in the current window" msgid "Show or hide the toolbar in the current window"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:155 #: ../xed/xed-ui.h:159
msgid "_Statusbar" msgid "_Statusbar"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:156 #: ../xed/xed-ui.h:160
msgid "Show or hide the statusbar in the current window" msgid "Show or hide the statusbar in the current window"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:159 #: ../xed/xed-ui.h:162
msgid "Fullscreen"
msgstr ""
#: ../xed/xed-ui.h:163
msgid "Edit text in fullscreen" msgid "Edit text in fullscreen"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:161 #: ../xed/xed-ui.h:165
msgid "_Word wrap" msgid "_Word wrap"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:162 #: ../xed/xed-ui.h:166
msgid "Set word wrap for the current document" msgid "Set word wrap for the current document"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:164 #: ../xed/xed-ui.h:168
msgid "_Overview Map" msgid "_Overview Map"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:165 #: ../xed/xed-ui.h:169
msgid "Show or hide the overview map for the current view" msgid "Show or hide the overview map for the current view"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:172 #: ../xed/xed-ui.h:176
msgid "Side _Pane" msgid "Side _Pane"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:173 #: ../xed/xed-ui.h:177
msgid "Show or hide the side pane in the current window" msgid "Show or hide the side pane in the current window"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:175 #: ../xed/xed-ui.h:179
msgid "_Bottom Pane" msgid "_Bottom Pane"
msgstr "" msgstr ""
#: ../xed/xed-ui.h:176 #: ../xed/xed-ui.h:180
msgid "Show or hide the bottom pane in the current window" msgid "Show or hide the bottom pane in the current window"
msgstr "" msgstr ""
#: ../xed/xed-utils.c:922 #: ../xed/xed-utils.c:642
msgid "Please check your installation." msgid "Please check your installation."
msgstr "" msgstr ""
#: ../xed/xed-utils.c:990 #: ../xed/xed-utils.c:710
#, c-format #, c-format
msgid "Unable to open UI file %s. Error: %s" msgid "Unable to open UI file %s. Error: %s"
msgstr "" msgstr ""
#: ../xed/xed-utils.c:1010 #: ../xed/xed-utils.c:730
#, c-format #, c-format
msgid "Unable to find the object '%s' inside file %s." msgid "Unable to find the object '%s' inside file %s."
msgstr "" msgstr ""
#. Translators: '/ on <remote-share>' #. Translators: '/ on <remote-share>'
#: ../xed/xed-utils.c:1178 #: ../xed/xed-utils.c:898
#, c-format #, c-format
msgid "/ on %s" msgid "/ on %s"
msgstr "" msgstr ""
@@ -2190,28 +2218,25 @@ msgstr ""
msgid "Activate '%s'" msgid "Activate '%s'"
msgstr "" msgstr ""
#: ../xed/xed-window.c:1324 #: ../xed/xed-window.c:1330
msgid "Spaces" #, c-format
msgid "Spaces: %u"
msgstr "" msgstr ""
#: ../xed/xed-window.c:1328 #: ../xed/xed-window.c:1334
msgid "Tabs" #, c-format
msgid "Tabs: %u"
msgstr "" msgstr ""
#: ../xed/xed-window.c:1389 #: ../xed/xed-window.c:1411
msgid "Use Spaces" msgid "Use Spaces"
msgstr "" msgstr ""
#: ../xed/xed-window.c:1829 #: ../xed/xed-window.c:2198
#, c-format
msgid "Tab Width: %u"
msgstr ""
#: ../xed/xed-window.c:2179
msgid "There are unsaved documents" msgid "There are unsaved documents"
msgstr "" msgstr ""
#: ../xed/xed-window.c:3221 #: ../xed/xed-window.c:3247
msgid "Elevated Privileges" msgid "Elevated Privileges"
msgstr "" msgstr ""
@@ -2380,67 +2405,67 @@ msgstr ""
msgid "Open a terminal at the currently opened directory" msgid "Open a terminal at the currently opened directory"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:562 #: ../plugins/filebrowser/xed-file-browser-plugin.c:560
msgid "File Browser" msgid "File Browser"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:673 #: ../plugins/filebrowser/xed-file-browser-plugin.c:671
msgid "An error occurred while creating a new directory" msgid "An error occurred while creating a new directory"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:676 #: ../plugins/filebrowser/xed-file-browser-plugin.c:674
msgid "An error occurred while creating a new file" msgid "An error occurred while creating a new file"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:679 #: ../plugins/filebrowser/xed-file-browser-plugin.c:677
msgid "An error occurred while renaming a file or directory" msgid "An error occurred while renaming a file or directory"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:682 #: ../plugins/filebrowser/xed-file-browser-plugin.c:680
msgid "An error occurred while deleting a file or directory" msgid "An error occurred while deleting a file or directory"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:685 #: ../plugins/filebrowser/xed-file-browser-plugin.c:683
msgid "An error occurred while opening a directory in the file manager" msgid "An error occurred while opening a directory in the file manager"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:688 #: ../plugins/filebrowser/xed-file-browser-plugin.c:686
msgid "An error occurred while setting a root directory" msgid "An error occurred while setting a root directory"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:691 #: ../plugins/filebrowser/xed-file-browser-plugin.c:689
msgid "An error occurred while loading a directory" msgid "An error occurred while loading a directory"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:694 #: ../plugins/filebrowser/xed-file-browser-plugin.c:692
msgid "An error occurred" msgid "An error occurred"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:951 #: ../plugins/filebrowser/xed-file-browser-plugin.c:949
msgid "" msgid ""
"Cannot move file to trash, do you\n" "Cannot move file to trash, do you\n"
"want to delete permanently?" "want to delete permanently?"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:956 #: ../plugins/filebrowser/xed-file-browser-plugin.c:954
#, c-format #, c-format
msgid "The file \"%s\" cannot be moved to the trash." msgid "The file \"%s\" cannot be moved to the trash."
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:961 #: ../plugins/filebrowser/xed-file-browser-plugin.c:959
msgid "The selected files cannot be moved to the trash." msgid "The selected files cannot be moved to the trash."
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:989 #: ../plugins/filebrowser/xed-file-browser-plugin.c:987
#, c-format #, c-format
msgid "Are you sure you want to permanently delete \"%s\"?" msgid "Are you sure you want to permanently delete \"%s\"?"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:994 #: ../plugins/filebrowser/xed-file-browser-plugin.c:992
msgid "Are you sure you want to permanently delete the selected files?" msgid "Are you sure you want to permanently delete the selected files?"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-plugin.c:997 #: ../plugins/filebrowser/xed-file-browser-plugin.c:995
msgid "If you delete an item, it is permanently lost." msgid "If you delete an item, it is permanently lost."
msgstr "" msgstr ""
@@ -2586,17 +2611,17 @@ msgstr ""
msgid "_Match Filename" msgid "_Match Filename"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-widget.c:1991 #: ../plugins/filebrowser/xed-file-browser-widget.c:2014
#, c-format #, c-format
msgid "No mount object for mounted volume: %s" msgid "No mount object for mounted volume: %s"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-widget.c:2069 #: ../plugins/filebrowser/xed-file-browser-widget.c:2092
#, c-format #, c-format
msgid "Could not open media: %s" msgid "Could not open media: %s"
msgstr "" msgstr ""
#: ../plugins/filebrowser/xed-file-browser-widget.c:2118 #: ../plugins/filebrowser/xed-file-browser-widget.c:2141
#, c-format #, c-format
msgid "Could not mount volume: %s" msgid "Could not mount volume: %s"
msgstr "" msgstr ""
@@ -2833,10 +2858,6 @@ msgstr ""
msgid "Columns" msgid "Columns"
msgstr "" msgstr ""
#: ../plugins/taglist/HTML.tags.xml.in.h:41
msgid "Comment"
msgstr ""
#: ../plugins/taglist/HTML.tags.xml.in.h:42 #: ../plugins/taglist/HTML.tags.xml.in.h:42
msgid "Computer code fragment" msgid "Computer code fragment"
msgstr "" msgstr ""
@@ -4181,7 +4202,7 @@ msgid "Available Tag Lists"
msgstr "" msgstr ""
#: ../plugins/taglist/xed-taglist-plugin-panel.c:706 #: ../plugins/taglist/xed-taglist-plugin-panel.c:706
#: ../plugins/taglist/xed-taglist-plugin-panel.c:722 #: ../plugins/taglist/xed-taglist-plugin-panel.c:721
#: ../plugins/taglist/xed-taglist-plugin.c:113 #: ../plugins/taglist/xed-taglist-plugin.c:113
msgid "Tags" msgid "Tags"
msgstr "" msgstr ""

View File

@@ -1,209 +0,0 @@
## Process this file with automake to produce Makefile.in
bin_PROGRAMS = xed
pkglib_LTLIBRARIES = libxed.la
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(srcdir) \
$(XED_CFLAGS) \
$(WARN_CFLAGS) \
$(INTROSPECTION_CFLAGS) \
$(DISABLE_DEPRECATED_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
-DLIBDIR=\""$(libdir)"\"
xed_SOURCES = \
xed.c
xed_LDADD = \
libxed.la \
$(XED_LIBS) \
$(INTROSPECTION_LIBS)
xed_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*"
libxed_la_LDFLAGS = -avoid-version -export-dynamic -no-undefined -export-symbols-regex "^[^_].*"
# XED_LIBS must be the last to ensure correct order on some platforms
libxed_la_LIBADD = $(XED_LIBS)
BUILT_SOURCES = \
xed-enum-types.c \
xed-enum-types.h \
xed-marshal.c \
xed-marshal.h
NOINST_H_FILES = \
xed-close-button.h \
xed-close-confirmation-dialog.h \
xed-dirs.h \
xed-document-private.h \
xed-documents-panel.h \
xed-encodings-dialog.h \
xed-highlight-mode-dialog.h \
xed-highlight-mode-selector.h \
xed-history-entry.h \
xed-io-error-info-bar.h \
xed-metadata-manager.h \
xed-paned.h \
xed-plugins-engine.h \
xed-preferences-dialog.h \
xed-print-job.h \
xed-print-preview.h \
xed-settings.h \
xed-status-menu-button.h \
xed-tab-label.h \
xed-ui.h \
xed-utils.h \
xed-view-frame.h \
xed-view-gutter-renderer.h \
xed-window-private.h
INST_H_FILES = \
xed-app.h \
xed-app-activatable.h \
xed-commands.h \
xed-debug.h \
xed-document.h \
xed-encodings-combo-box.h \
xed-file-chooser-dialog.h \
xed-message-bus.h \
xed-message-type.h \
xed-message.h \
xed-notebook.h \
xed-panel.h \
xed-progress-info-bar.h \
xed-searchbar.h \
xed-statusbar.h \
xed-tab.h \
xed-view.h \
xed-view-activatable.h \
xed-window.h \
xed-window-activatable.h
headerdir = $(prefix)/include/xed
header_DATA = \
$(INST_H_FILES)
BUILT_SOURCES_PRIVATE = \
xed-resources.c
libxed_c_files = \
xed-app.c \
xed-app-activatable.c \
xed-view-activatable.c \
xed-window-activatable.c \
xed-resources.c \
xed-close-button.c \
xed-close-confirmation-dialog.c \
xed-commands-documents.c \
xed-commands-edit.c \
xed-commands-file.c \
xed-commands-file-print.c \
xed-commands-help.c \
xed-commands-search.c \
xed-commands-view.c \
xed-debug.c \
xed-dirs.c \
xed-document.c \
xed-documents-panel.c \
xed-encodings-combo-box.c \
xed-encodings-dialog.c \
xed-file-chooser-dialog.c \
xed-highlight-mode-dialog.c \
xed-highlight-mode-selector.c \
xed-history-entry.c \
xed-io-error-info-bar.c \
xed-message-bus.c \
xed-message-type.c \
xed-message.c \
xed-metadata-manager.c \
xed-notebook.c \
xed-paned.c \
xed-panel.c \
xed-plugins-engine.c \
xed-preferences-dialog.c \
xed-print-job.c \
xed-print-preview.c \
xed-progress-info-bar.c \
xed-settings.c \
xed-searchbar.c \
xed-statusbar.c \
xed-status-menu-button.c \
xed-tab.c \
xed-tab-label.c \
xed-utils.c \
xed-view.c \
xed-view-frame.c \
xed-view-gutter-renderer.c \
xed-window.c
libxed_la_SOURCES = \
$(BUILT_SOURCES) \
$(libxed_c_files) \
$(POSIXIO_FILES) \
$(NOINST_H_FILES) \
$(INST_H_FILES)
xed-enum-types.h: xed-enum-types.h.template $(INST_H_FILES) $(GLIB_MKENUMS)
$(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template xed-enum-types.h.template $(INST_H_FILES)) > $@
xed-enum-types.c: xed-enum-types.c.template $(INST_H_FILES) $(GLIB_MKENUMS)
$(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template xed-enum-types.c.template $(INST_H_FILES)) > $@
xed-marshal.h: xed-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=xed_marshal > $@
xed-marshal.c: xed-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN) echo "#include \"xed-marshal.h\"" > $@ && \
$(GLIB_GENMARSHAL) $< --body --prefix=xed_marshal >> $@
xed-resources.c: resources/xed.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir)/resources --generate-dependencies $(srcdir)/resources/xed.gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/resources --generate-source $(srcdir)/resources/xed.gresource.xml
EXTRA_DIST = \
xed-enum-types.h.template \
xed-enum-types.c.template \
xed-marshal.list \
xed.rc \
resources/xed.gresource.xml \
resources/ui/xed-ui.xml \
resources/ui/xed-encodings-dialog.ui \
resources/ui/xed-preferences-dialog.ui \
resources/ui/xed-print-preferences.ui \
resources/ui/xed-searchbar.ui \
resources/ui/xed-view-frame.ui
CLEANFILES = $(BUILT_SOURCES) $(BUILT_SOURCES_PRIVATE)
if HAVE_INTROSPECTION
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS = Xed-1.0.gir
Xed-1.0.gir: xed
INTROSPECTION_SCANNER_ARGS = -I$(top_srcdir) --warn-all
Xed_1_0_gir_NAMESPACE = Xed
Xed_1_0_gir_VERSION = 1.0
Xed_1_0_gir_PROGRAM = $(builddir)/xed
Xed_1_0_gir_FILES = $(INST_H_FILES) $(libxed_c_files) $(BUILT_SOURCES)
Xed_1_0_gir_INCLUDES = Gtk-3.0 GtkSource-3.0
girdir = $(datadir)/xed/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)
typelibdir = $(libdir)/xed/girepository-1.0
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += \
$(gir_DATA) \
$(typelib_DATA)
endif
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES) $(BUILT_SOURCES_PRIVATE)
-include $(top_srcdir)/git.mk

View File

@@ -11,3 +11,14 @@
min-height: 0; min-height: 0;
min-width: 0; min-width: 0;
} }
/*remove a keybinding so that we can use it for toggling comments*/
@binding-set xed-view-bindings
{
unbind "<Control>slash";
}
textview
{
-gtk-key-bindings: xed-view-bindings;
}

View File

@@ -327,6 +327,20 @@
<property name="title" translatable="yes">Decrement number at cursor</property> <property name="title" translatable="yes">Decrement number at cursor</property>
</object> </object>
</child> </child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;shift&gt;slash</property>
<property name="title" translatable="yes">Toggle comment block</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;slash</property>
<property name="title" translatable="yes">Toggle comment</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>

View File

@@ -38,6 +38,9 @@
<menuitem name="EditSelectAllMenu" action="EditSelectAll"/> <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
<placeholder name="EditOps_3" /> <placeholder name="EditOps_3" />
<separator/> <separator/>
<menuitem name="EditToggleCommentMenu" action="EditToggleComment"/>
<menuitem name="EditToggleCommentBlockMenu" action="EditToggleCommentBlock"/>
<separator/>
<placeholder name="EditOps_4" /> <placeholder name="EditOps_4" />
<separator/> <separator/>
<placeholder name="EditOps_5" /> <placeholder name="EditOps_5" />

View File

@@ -356,93 +356,6 @@ xed_app_startup (GApplication *application)
app); app);
} }
static gboolean
is_in_viewport (GtkWindow *window,
GdkScreen *screen,
gint workspace,
gint viewport_x,
gint viewport_y)
{
GdkScreen *s;
GdkDisplay *display;
GdkWindow *gdkwindow;
const gchar *cur_name;
const gchar *name;
gint cur_n;
gint n;
gint ws;
gint sc_width, sc_height;
gint x, y, width, height;
gint vp_x, vp_y;
/* Check for screen and display match */
display = gdk_screen_get_display (screen);
cur_name = gdk_display_get_name (display);
cur_n = gdk_screen_get_number (screen);
s = gtk_window_get_screen (window);
display = gdk_screen_get_display (s);
name = gdk_display_get_name (display);
n = gdk_screen_get_number (s);
if (strcmp (cur_name, name) != 0 || cur_n != n)
{
return FALSE;
}
/* Check for workspace match */
ws = xed_utils_get_window_workspace (window);
if (ws != workspace && ws != XED_ALL_WORKSPACES)
{
return FALSE;
}
/* Check for viewport match */
gdkwindow = gtk_widget_get_window (GTK_WIDGET (window));
gdk_window_get_position (gdkwindow, &x, &y);
width = gdk_window_get_width (gdkwindow);
height = gdk_window_get_height (gdkwindow);
xed_utils_get_current_viewport (screen, &vp_x, &vp_y);
x += vp_x;
y += vp_y;
sc_width = gdk_screen_get_width (screen);
sc_height = gdk_screen_get_height (screen);
return x + width * .25 >= viewport_x &&
x + width * .75 <= viewport_x + sc_width &&
y >= viewport_y &&
y + height <= viewport_y + sc_height;
}
static XedWindow *
get_active_window (GtkApplication *app)
{
GdkScreen *screen;
guint workspace;
gint viewport_x, viewport_y;
GList *windows, *l;
screen = gdk_screen_get_default ();
workspace = xed_utils_get_current_workspace (screen);
xed_utils_get_current_viewport (screen, &viewport_x, &viewport_y);
/* Gtk documentation says the window list is always in MRU order */
windows = gtk_application_get_windows (app);
for (l = windows; l != NULL; l = l->next)
{
GtkWindow *window = l->data;
if (is_in_viewport (window, screen, workspace, viewport_x, viewport_y))
{
return XED_WINDOW (window);
}
}
return NULL;
}
static void static void
set_command_line_wait (XedApp *app, set_command_line_wait (XedApp *app,
XedTab *tab) XedTab *tab)
@@ -479,7 +392,7 @@ open_files (GApplication *application,
if (!new_window) if (!new_window)
{ {
window = get_active_window (GTK_APPLICATION (application)); window = XED_WINDOW (gtk_application_get_active_window (GTK_APPLICATION (application)));
} }
if (window == NULL) if (window == NULL)
@@ -1251,7 +1164,8 @@ xed_app_show_help (XedApp *app,
link = g_strdup_printf ("help:%s", name); link = g_strdup_printf ("help:%s", name);
} }
ret = gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (parent)), link, GDK_CURRENT_TIME, &error); ret = gtk_show_uri_on_window (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (parent))),
link, GDK_CURRENT_TIME, &error);
g_free (link); g_free (link);

View File

@@ -169,3 +169,156 @@ _xed_cmd_edit_preferences (GtkAction *action,
xed_show_preferences_dialog (window); xed_show_preferences_dialog (window);
} }
void
_xed_cmd_edit_toggle_comment (GtkAction *action,
XedWindow *window)
{
XedView *active_view;
GtkSourceBuffer *active_document;
GtkSourceLanguage *language;
const gchar *comment_text;
gint start_line;
gint end_line;
gint i;
gboolean is_comment = FALSE;
GtkTextIter start_iter;
GtkTextIter end_iter;
xed_debug (DEBUG_COMMANDS);
active_view = xed_window_get_active_view (window);
if (active_view == NULL)
{
return;
}
active_document = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (active_view)));
language = gtk_source_buffer_get_language (active_document);
if (language == NULL)
{
return;
}
comment_text = gtk_source_language_get_metadata (language, "line-comment-start");
if (comment_text == NULL)
{
return;
}
gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (active_document), &start_iter, &end_iter);
start_line = gtk_text_iter_get_line (&start_iter);
end_line = gtk_text_iter_get_line (&end_iter);
gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (active_document)); // begin
// if some lines are already commented, consider the whole block commented and uncomment them
for (i = start_line; i <= end_line; i++)
{
GtkTextIter start_line_iter;
GtkTextIter end_line_iter;
const gchar *line_text;
gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (active_document), &start_line_iter, i);
end_line_iter = start_line_iter;
gtk_text_iter_forward_to_line_end (&end_line_iter);
line_text = gtk_text_buffer_get_slice (GTK_TEXT_BUFFER (active_document), &start_line_iter, &end_line_iter, TRUE);
if (g_str_has_prefix (line_text, comment_text))
{
is_comment = TRUE;
end_line_iter = start_line_iter;
gtk_text_iter_forward_chars (&end_line_iter, strlen(comment_text));
gtk_text_buffer_delete (GTK_TEXT_BUFFER (active_document), &start_line_iter, &end_line_iter);
}
}
// only comment if nothing was commented to begin with
if (!is_comment)
{
for (i = start_line; i <= end_line; i++)
{
GtkTextIter insert_iter;
gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (active_document), &insert_iter, i);
gtk_text_buffer_insert (GTK_TEXT_BUFFER (active_document), &insert_iter, comment_text, -1);
}
}
gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (active_document)); // end
}
void
_xed_cmd_edit_toggle_comment_block (GtkAction *action,
XedWindow *window)
{
XedView *active_view;
GtkSourceBuffer *active_document;
GtkSourceLanguage *language;
const gchar *start_text;
const gchar *end_text;
GtkTextIter start_iter;
GtkTextIter end_iter;
gchar *selected_text;
gchar *insert_text;
xed_debug (DEBUG_COMMANDS);
active_view = xed_window_get_active_view (window);
if (active_view == NULL)
{
return;
}
active_document = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (active_view)));
language = gtk_source_buffer_get_language (active_document);
if (language == NULL)
{
return;
}
start_text = gtk_source_language_get_metadata (language, "block-comment-start");
end_text = gtk_source_language_get_metadata (language, "block-comment-end");
if (start_text == NULL || end_text == NULL)
{
return;
}
gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (active_document), &start_iter, &end_iter);
selected_text = gtk_text_buffer_get_slice (GTK_TEXT_BUFFER (active_document), &start_iter, &end_iter, TRUE);
if (g_str_has_prefix (selected_text, start_text) && g_str_has_suffix (selected_text, end_text))
{
gint start = strlen (start_text);
gint end = strlen (end_text);
const gchar *tmp = selected_text + start;
insert_text = g_strndup (tmp , strlen(selected_text) - start - end);
}
else
{
insert_text = g_strconcat (start_text, selected_text, end_text, NULL);
}
gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (active_document)); // begin
// replace the selected text with the commented/uncommented version
gtk_text_buffer_delete (GTK_TEXT_BUFFER (active_document), &start_iter, &end_iter);
gtk_text_buffer_insert (GTK_TEXT_BUFFER (active_document), &end_iter, insert_text, -1);
// move selection back where it was
gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (active_document), &start_iter,
gtk_text_iter_get_offset (&end_iter) - strlen (insert_text));
gtk_text_buffer_select_range (GTK_TEXT_BUFFER (active_document), &start_iter, &end_iter);
gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (active_document)); // end
g_free (selected_text);
g_free (insert_text);
}

View File

@@ -42,6 +42,8 @@ void _xed_cmd_edit_paste (GtkAction *action, XedWindow *window);
void _xed_cmd_edit_delete (GtkAction *action, XedWindow *window); void _xed_cmd_edit_delete (GtkAction *action, XedWindow *window);
void _xed_cmd_edit_select_all (GtkAction *action, XedWindow *window); void _xed_cmd_edit_select_all (GtkAction *action, XedWindow *window);
void _xed_cmd_edit_preferences (GtkAction *action, XedWindow *window); void _xed_cmd_edit_preferences (GtkAction *action, XedWindow *window);
void _xed_cmd_edit_toggle_comment (GtkAction *action, XedWindow *window);
void _xed_cmd_edit_toggle_comment_block (GtkAction *action, XedWindow *window);
void _xed_cmd_view_show_toolbar (GtkAction *action, XedWindow *window); void _xed_cmd_view_show_toolbar (GtkAction *action, XedWindow *window);
void _xed_cmd_view_show_statusbar (GtkAction *action, XedWindow *window); void _xed_cmd_view_show_statusbar (GtkAction *action, XedWindow *window);

View File

@@ -525,20 +525,7 @@ show_popup_menu (XedDocumentsPanel *panel,
menu = gtk_ui_manager_get_widget (xed_window_get_ui_manager (panel->priv->window), "/NotebookPopup"); menu = gtk_ui_manager_get_widget (xed_window_get_ui_manager (panel->priv->window), "/NotebookPopup");
g_return_val_if_fail (menu != NULL, FALSE); g_return_val_if_fail (menu != NULL, FALSE);
if (event != NULL) gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
{
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
NULL, NULL,
event->button, event->time);
}
else
{
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
(GtkMenuPositionFunc) menu_position, panel,
0, gtk_get_current_event_time ());
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
}
return TRUE; return TRUE;
} }

View File

@@ -186,13 +186,17 @@ static XedNotebook *
find_notebook_at_pointer (gint abs_x, find_notebook_at_pointer (gint abs_x,
gint abs_y) gint abs_y)
{ {
GdkSeat *seat;
GdkDevice *device;
GdkWindow *win_at_pointer; GdkWindow *win_at_pointer;
GdkWindow *toplevel_win; GdkWindow *toplevel_win;
gpointer toplevel = NULL; gpointer toplevel = NULL;
gint x, y; gint x, y;
/* FIXME multi-head */ seat = gdk_display_get_default_seat (gdk_display_get_default ());
win_at_pointer = gdk_window_at_pointer (&x, &y); device = gdk_seat_get_pointer (seat);
win_at_pointer = gdk_device_get_window_at_position (device, &x, &y);
if (win_at_pointer == NULL) if (win_at_pointer == NULL)
{ {
/* We are outside all windows of the same application */ /* We are outside all windows of the same application */
@@ -702,18 +706,6 @@ xed_notebook_switch_page_cb (GtkNotebook *notebook,
gtk_widget_grab_focus (GTK_WIDGET (view)); gtk_widget_grab_focus (GTK_WIDGET (view));
} }
/*
* update_tabs_visibility: Hide tabs if there is only one tab
*/
static void
update_tabs_visibility (XedNotebook *notebook)
{
gboolean show_tabs;
show_tabs = (gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) > 1);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), show_tabs);
}
static void static void
xed_notebook_init (XedNotebook *notebook) xed_notebook_init (XedNotebook *notebook)
{ {
@@ -726,7 +718,6 @@ xed_notebook_init (XedNotebook *notebook)
gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE); gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (notebook), 0); gtk_container_set_border_width (GTK_CONTAINER (notebook), 0);
g_signal_connect (notebook, "button-press-event", g_signal_connect (notebook, "button-press-event",
@@ -867,7 +858,6 @@ xed_notebook_add_tab (XedNotebook *nb,
tab_label = create_tab_label (nb, tab); tab_label = create_tab_label (nb, tab);
gtk_notebook_insert_page (GTK_NOTEBOOK (nb), GTK_WIDGET (tab), tab_label, position); gtk_notebook_insert_page (GTK_NOTEBOOK (nb), GTK_WIDGET (tab), tab_label, position);
update_tabs_visibility (nb);
g_signal_emit (G_OBJECT (nb), signals[TAB_ADDED], 0, tab); g_signal_emit (G_OBJECT (nb), signals[TAB_ADDED], 0, tab);
@@ -927,7 +917,6 @@ remove_tab (XedTab *tab,
remove_tab_label (nb, tab); remove_tab_label (nb, tab);
gtk_notebook_remove_page (GTK_NOTEBOOK (nb), position); gtk_notebook_remove_page (GTK_NOTEBOOK (nb), position);
update_tabs_visibility (nb);
g_signal_emit (G_OBJECT (nb), signals[TAB_REMOVED], 0, tab); g_signal_emit (G_OBJECT (nb), signals[TAB_REMOVED], 0, tab);

View File

@@ -276,9 +276,9 @@ restore_button_clicked (GtkButton *button,
header = g_settings_get_string (job->priv->print_settings, XED_SETTINGS_PRINT_FONT_HEADER_PANGO); header = g_settings_get_string (job->priv->print_settings, XED_SETTINGS_PRINT_FONT_HEADER_PANGO);
numbers = g_settings_get_string (job->priv->print_settings, XED_SETTINGS_PRINT_FONT_NUMBERS_PANGO); numbers = g_settings_get_string (job->priv->print_settings, XED_SETTINGS_PRINT_FONT_NUMBERS_PANGO);
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->body_fontbutton), body); gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->body_fontbutton), body);
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->headers_fontbutton), header); gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->headers_fontbutton), header);
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->numbers_fontbutton), numbers); gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->numbers_fontbutton), numbers);
g_free (body); g_free (body);
g_free (header); g_free (header);
@@ -372,13 +372,13 @@ create_custom_widget_cb (GtkPrintOperation *operation,
gtk_widget_set_sensitive (job->priv->do_not_split_checkbutton, wrap_mode != GTK_WRAP_NONE); gtk_widget_set_sensitive (job->priv->do_not_split_checkbutton, wrap_mode != GTK_WRAP_NONE);
/* Set initial values */ /* Set initial values */
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->body_fontbutton), font_body); gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->body_fontbutton), font_body);
g_free (font_body); g_free (font_body);
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->headers_fontbutton), font_header); gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->headers_fontbutton), font_header);
g_free (font_header); g_free (font_header);
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->numbers_fontbutton), font_numbers); gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->numbers_fontbutton), font_numbers);
g_free (font_numbers); g_free (font_numbers);
g_signal_connect (job->priv->line_numbers_checkbutton, "toggled", g_signal_connect (job->priv->line_numbers_checkbutton, "toggled",
@@ -404,9 +404,9 @@ custom_widget_apply_cb (GtkPrintOperation *operation,
syntax = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (job->priv->syntax_checkbutton)); syntax = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (job->priv->syntax_checkbutton));
page_header = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (job->priv->page_header_checkbutton)); page_header = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (job->priv->page_header_checkbutton));
body = gtk_font_button_get_font_name (GTK_FONT_BUTTON (job->priv->body_fontbutton)); body = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (job->priv->body_fontbutton));
header = gtk_font_button_get_font_name (GTK_FONT_BUTTON (job->priv->headers_fontbutton)); header = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (job->priv->headers_fontbutton));
numbers = gtk_font_button_get_font_name (GTK_FONT_BUTTON (job->priv->numbers_fontbutton)); numbers = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (job->priv->numbers_fontbutton));
g_settings_set_boolean (job->priv->print_settings, XED_SETTINGS_PRINT_SYNTAX_HIGHLIGHTING, syntax); g_settings_set_boolean (job->priv->print_settings, XED_SETTINGS_PRINT_SYNTAX_HIGHLIGHTING, syntax);
g_settings_set_boolean (job->priv->print_settings, XED_SETTINGS_PRINT_HEADER, page_header); g_settings_set_boolean (job->priv->print_settings, XED_SETTINGS_PRINT_HEADER, page_header);

View File

@@ -82,6 +82,9 @@ struct _XedPrintPreviewPrivate
G_DEFINE_TYPE (XedPrintPreview, xed_print_preview, GTK_TYPE_BOX) G_DEFINE_TYPE (XedPrintPreview, xed_print_preview, GTK_TYPE_BOX)
static void goto_page (XedPrintPreview *preview,
gint page);
static void static void
xed_print_preview_get_property (GObject *object, xed_print_preview_get_property (GObject *object,
guint prop_id, guint prop_id,
@@ -173,6 +176,7 @@ set_rows_and_cols (XedPrintPreview *preview,
preview->priv->rows = rows; preview->priv->rows = rows;
preview->priv->cols = cols; preview->priv->cols = cols;
update_layout_size (preview); update_layout_size (preview);
goto_page (preview, preview->priv->cur_page - (preview->priv->cur_page % (preview->priv->rows * preview->priv->cols)));
} }
/* get the paper size in points: these must be used only /* get the paper size in points: these must be used only
@@ -312,7 +316,7 @@ goto_page (XedPrintPreview *preview,
gtk_widget_set_sensitive (GTK_WIDGET (preview->priv->prev), (page > 0) && (preview->priv->n_pages > 1)); gtk_widget_set_sensitive (GTK_WIDGET (preview->priv->prev), (page > 0) && (preview->priv->n_pages > 1));
gtk_widget_set_sensitive (GTK_WIDGET (preview->priv->next), gtk_widget_set_sensitive (GTK_WIDGET (preview->priv->next),
(page != (preview->priv->n_pages - 1)) && (page < (preview->priv->n_pages - preview->priv->rows * preview->priv->cols)) &&
(preview->priv->n_pages > 1)); (preview->priv->n_pages > 1));
if (page != preview->priv->cur_page) if (page != preview->priv->cur_page)
@@ -499,7 +503,7 @@ multi_button_clicked (GtkWidget *button,
gtk_menu_attach (GTK_MENU (m), i, 1, 2, 1, 2); gtk_menu_attach (GTK_MENU (m), i, 1, 2, 1, 2);
g_signal_connect (i, "activate", G_CALLBACK (on_2x2_clicked), preview); g_signal_connect (i, "activate", G_CALLBACK (on_2x2_clicked), preview);
gtk_menu_popup (GTK_MENU (m), NULL, NULL, NULL, preview, 0, GDK_CURRENT_TIME); gtk_menu_popup_at_widget (GTK_MENU (m), button, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL);
} }
static void static void
@@ -920,9 +924,6 @@ preview_layout_key_press (GtkWidget *widget,
{ {
gtk_adjustment_set_value (hadj, x); gtk_adjustment_set_value (hadj, x);
gtk_adjustment_set_value (vadj, y); gtk_adjustment_set_value (vadj, y);
gtk_adjustment_value_changed (hadj);
gtk_adjustment_value_changed (vadj);
} }
return ret; return ret;
@@ -1124,7 +1125,7 @@ preview_draw (GtkWidget *widget,
break; break;
} }
draw_page (cr, j * priv->tile_w, i * priv->tile_h, pg, preview); draw_page (cr, i * priv->tile_w, j * priv->tile_h, pg, preview);
++pg; ++pg;
} }

View File

@@ -136,7 +136,7 @@ forward_search_finished (GtkSourceSearchContext *search_context,
GtkTextIter match_start; GtkTextIter match_start;
GtkTextIter match_end; GtkTextIter match_end;
found = gtk_source_search_context_forward_finish (search_context, result, &match_start, &match_end, NULL); found = gtk_source_search_context_forward_finish2 (search_context, result, &match_start, &match_end, NULL, NULL);
buffer = gtk_source_search_context_get_buffer (search_context); buffer = gtk_source_search_context_get_buffer (search_context);
if (found) if (found)
@@ -210,7 +210,7 @@ backward_search_finished (GtkSourceSearchContext *search_context,
GtkTextIter match_end; GtkTextIter match_end;
GtkSourceBuffer *buffer; GtkSourceBuffer *buffer;
found = gtk_source_search_context_backward_finish (search_context, result, &match_start, &match_end, NULL); found = gtk_source_search_context_backward_finish2 (search_context, result, &match_start, &match_end, NULL, NULL);
buffer = gtk_source_search_context_get_buffer (search_context); buffer = gtk_source_search_context_get_buffer (search_context);
if (found) if (found)
@@ -479,12 +479,12 @@ do_replace (XedSearchbar *searchbar)
gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc), &start, &end); gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc), &start, &end);
searchbar->priv->search_mode = XED_SEARCH_MODE_REPLACE; searchbar->priv->search_mode = XED_SEARCH_MODE_REPLACE;
gtk_source_search_context_replace (search_context, gtk_source_search_context_replace2 (search_context,
&start, &start,
&end, &end,
unescaped_replace_text, unescaped_replace_text,
-1, -1,
NULL); NULL);
g_free (unescaped_replace_text); g_free (unescaped_replace_text);

View File

@@ -87,8 +87,7 @@ xed_status_menu_button_class_init (XedStatusMenuButtonClass *klass)
{ {
static const gchar style[] = static const gchar style[] =
"* {\n" "* {\n"
"padding: 1px 8px 2px 4px;\n" "padding: 2px;\n"
"border: 0;\n"
"outline-width: 0;\n" "outline-width: 0;\n"
"}"; "}";

View File

@@ -269,7 +269,6 @@ xed_tab_dispose (GObject *object)
{ {
XedTab *tab = XED_TAB (object); XedTab *tab = XED_TAB (object);
g_clear_object (&tab->priv->editor);
g_clear_object (&tab->priv->task_saver); g_clear_object (&tab->priv->task_saver);
clear_loading (tab); clear_loading (tab);
@@ -282,6 +281,8 @@ xed_tab_finalize (GObject *object)
{ {
XedTab *tab = XED_TAB (object); XedTab *tab = XED_TAB (object);
g_clear_object (&tab->priv->editor);
if (tab->priv->timer != NULL) if (tab->priv->timer != NULL)
{ {
g_timer_destroy (tab->priv->timer); g_timer_destroy (tab->priv->timer);

View File

@@ -102,6 +102,10 @@ static const GtkActionEntry xed_menu_entries[] =
N_("Delete the selected text"), G_CALLBACK (_xed_cmd_edit_delete) }, N_("Delete the selected text"), G_CALLBACK (_xed_cmd_edit_delete) },
{ "EditSelectAll", "edit-select-all-symbolic", N_("Select _All"), "<control>A", { "EditSelectAll", "edit-select-all-symbolic", N_("Select _All"), "<control>A",
N_("Select the entire document"), G_CALLBACK (_xed_cmd_edit_select_all) }, N_("Select the entire document"), G_CALLBACK (_xed_cmd_edit_select_all) },
{ "EditToggleComment", NULL, N_("_Toggle Comment"), "<control>slash",
N_("Comment"), G_CALLBACK (_xed_cmd_edit_toggle_comment) },
{ "EditToggleCommentBlock", NULL, N_("Toggle Comment _Block"), "<shift><control>question",
N_("Comment Block"), G_CALLBACK (_xed_cmd_edit_toggle_comment_block) },
/* View menu */ /* View menu */
{ "ViewHighlightMode", NULL, N_("_Highlight Mode"), "<shift><control>H", { "ViewHighlightMode", NULL, N_("_Highlight Mode"), "<shift><control>H",
@@ -155,7 +159,7 @@ static const GtkToggleActionEntry xed_always_sensitive_toggle_menu_entries[] =
{ "ViewStatusbar", NULL, N_("_Statusbar"), NULL, { "ViewStatusbar", NULL, N_("_Statusbar"), NULL,
N_("Show or hide the statusbar in the current window"), N_("Show or hide the statusbar in the current window"),
G_CALLBACK (_xed_cmd_view_show_statusbar), TRUE }, G_CALLBACK (_xed_cmd_view_show_statusbar), TRUE },
{ "ViewFullscreen", GTK_STOCK_FULLSCREEN, NULL, "F11", { "ViewFullscreen", "view-fullscreen", N_("Fullscreen"), "F11",
N_("Edit text in fullscreen"), N_("Edit text in fullscreen"),
G_CALLBACK (_xed_cmd_view_toggle_fullscreen_mode), FALSE }, G_CALLBACK (_xed_cmd_view_toggle_fullscreen_mode), FALSE },
{ "ViewWordWrap", NULL, N_("_Word wrap"), NULL, { "ViewWordWrap", NULL, N_("_Word wrap"), NULL,

View File

@@ -54,99 +54,6 @@
#define STDIN_DELAY_MICROSECONDS 100000 #define STDIN_DELAY_MICROSECONDS 100000
static void
widget_get_origin (GtkWidget *widget,
gint *x,
gint *y)
{
GdkWindow *window;
window = gtk_widget_get_window (widget);
gdk_window_get_origin (window, x, y);
}
void
xed_utils_menu_position_under_widget (GtkMenu *menu,
gint *x,
gint *y,
gboolean *push_in,
gpointer user_data)
{
GtkWidget *widget;
GtkRequisition requisition;
GtkAllocation allocation;
widget = GTK_WIDGET (user_data);
widget_get_origin (widget, x, y);
gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &requisition);
gtk_widget_get_allocation (widget, &allocation);
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
{
*x += allocation.x + allocation.width - requisition.width;
}
else
{
*x += allocation.x;
}
*y += allocation.y + allocation.height;
*push_in = TRUE;
}
void
xed_utils_menu_position_under_tree_view (GtkMenu *menu,
gint *x,
gint *y,
gboolean *push_in,
gpointer user_data)
{
GtkTreeView *tree = GTK_TREE_VIEW (user_data);
GtkTreeModel *model;
GtkTreeSelection *selection;
GtkTreeIter iter;
model = gtk_tree_view_get_model (tree);
g_return_if_fail (model != NULL);
selection = gtk_tree_view_get_selection (tree);
g_return_if_fail (selection != NULL);
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
{
GtkTreePath *path;
GdkRectangle rect;
widget_get_origin (GTK_WIDGET (tree), x, y);
path = gtk_tree_model_get_path (model, &iter);
gtk_tree_view_get_cell_area (tree, path,
gtk_tree_view_get_column (tree, 0), /* FIXME 0 for RTL ? */
&rect);
gtk_tree_path_free (path);
*x += rect.x;
*y += rect.y + rect.height;
if (gtk_widget_get_direction (GTK_WIDGET (tree)) == GTK_TEXT_DIR_RTL)
{
GtkRequisition requisition;
gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &requisition);
*x += rect.width - requisition.width;
}
}
else
{
/* no selection -> regular "under widget" positioning */
xed_utils_menu_position_under_widget (menu, x, y, push_in, tree);
}
}
/* FIXME: remove this with gtk 2.12, it has gdk_color_to_string */ /* FIXME: remove this with gtk 2.12, it has gdk_color_to_string */
gchar * gchar *
xed_gdk_color_to_string (GdkColor color) xed_gdk_color_to_string (GdkColor color)
@@ -630,193 +537,6 @@ xed_utils_replace_home_dir_with_tilde (const gchar *uri)
return g_strdup (uri); return g_strdup (uri);
} }
/* the following two functions are courtesy of galeon */
/**
* xed_utils_get_current_workspace:
*
* Get the current workspace
*
* Get the currently visible workspace for the #GdkScreen.
*
* If the X11 window property isn't found, 0 (the first workspace)
* is returned.
*/
guint
xed_utils_get_current_workspace (GdkScreen *screen)
{
#ifdef GDK_WINDOWING_X11
GdkWindow *root_win;
GdkDisplay *display;
guint ret = 0;
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
root_win = gdk_screen_get_root_window (screen);
display = gdk_screen_get_display (screen);
if (GDK_IS_X11_DISPLAY (display))
{
Atom type;
gint format;
gulong nitems;
gulong bytes_after;
guint *current_desktop;
gint err, result;
gdk_error_trap_push ();
result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (root_win),
gdk_x11_get_xatom_by_name_for_display (display, "_NET_CURRENT_DESKTOP"),
0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, (gpointer) &current_desktop);
err = gdk_error_trap_pop ();
if (err != Success || result != Success)
{
return ret;
}
if (type == XA_CARDINAL && format == 32 && nitems > 0)
{
ret = current_desktop[0];
}
XFree (current_desktop);
}
return ret;
#else
/* FIXME: on mac etc proably there are native APIs
* to get the current workspace etc */
return 0;
#endif
}
/**
* xed_utils_get_window_workspace:
*
* Get the workspace the window is on
*
* This function gets the workspace that the #GtkWindow is visible on,
* it returns XED_ALL_WORKSPACES if the window is sticky, or if
* the window manager doesn support this function
*/
guint
xed_utils_get_window_workspace (GtkWindow *gtkwindow)
{
#ifdef GDK_WINDOWING_X11
GdkWindow *window;
GdkDisplay *display;
Atom type;
gint format;
gulong nitems;
gulong bytes_after;
guint *workspace;
gint err, result;
guint ret = XED_ALL_WORKSPACES;
g_return_val_if_fail (GTK_IS_WINDOW (gtkwindow), 0);
g_return_val_if_fail (gtk_widget_get_realized (GTK_WIDGET (gtkwindow)), 0);
window = gtk_widget_get_window (GTK_WIDGET (gtkwindow));
display = gdk_window_get_display (window);
if (GDK_IS_X11_DISPLAY (display))
{
gdk_error_trap_push ();
result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP"),
0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, (gpointer) &workspace);
err = gdk_error_trap_pop ();
if (err != Success || result != Success)
{
return ret;
}
if (type == XA_CARDINAL && format == 32 && nitems > 0)
{
ret = workspace[0];
}
XFree (workspace);
}
return ret;
#else
/* FIXME: on mac etc proably there are native APIs
* to get the current workspace etc */
return 0;
#endif
}
/**
* xed_utils_get_current_viewport:
*
* Get the current viewport origin
*
* Get the currently visible viewport origin for the #GdkScreen.
*
* If the X11 window property isn't found, (0, 0) is returned.
*/
void
xed_utils_get_current_viewport (GdkScreen *screen,
gint *x,
gint *y)
{
#ifdef GDK_WINDOWING_X11
GdkWindow *root_win;
GdkDisplay *display;
Atom type;
gint format;
gulong nitems;
gulong bytes_after;
gulong *coordinates;
gint err, result;
g_return_if_fail (GDK_IS_SCREEN (screen));
g_return_if_fail (x != NULL && y != NULL);
/* Default values for the viewport origin */
*x = 0;
*y = 0;
root_win = gdk_screen_get_root_window (screen);
display = gdk_screen_get_display (screen);
if (GDK_IS_X11_DISPLAY (display))
{
gdk_error_trap_push ();
result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (root_win),
gdk_x11_get_xatom_by_name_for_display (display, "_NET_DESKTOP_VIEWPORT"),
0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, (void*) &coordinates);
err = gdk_error_trap_pop ();
if (err != Success || result != Success)
{
return;
}
if (type != XA_CARDINAL || format != 32 || nitems < 2)
{
XFree (coordinates);
return;
}
*x = coordinates[0];
*y = coordinates[1];
XFree (coordinates);
}
#else
/* FIXME: on mac etc proably there are native APIs
* to get the current workspace etc */
*x = 0;
*y = 0;
#endif
}
static gboolean static gboolean
is_valid_scheme_character (gchar c) is_valid_scheme_character (gchar c)
{ {

View File

@@ -48,18 +48,6 @@ G_BEGIN_DECLS
enum { XED_ALL_WORKSPACES = 0xffffffff }; enum { XED_ALL_WORKSPACES = 0xffffffff };
void xed_utils_menu_position_under_widget (GtkMenu *menu,
gint *x,
gint *y,
gboolean *push_in,
gpointer user_data);
void xed_utils_menu_position_under_tree_view (GtkMenu *menu,
gint *x,
gint *y,
gboolean *push_in,
gpointer user_data);
gchar *xed_gdk_color_to_string (GdkColor color); gchar *xed_gdk_color_to_string (GdkColor color);
gchar *xed_utils_escape_underscores (const gchar *text, gchar *xed_utils_escape_underscores (const gchar *text,
@@ -97,14 +85,6 @@ gchar *xed_utils_location_get_dirname_for_display (GFile *location);
gchar *xed_utils_replace_home_dir_with_tilde (const gchar *uri); gchar *xed_utils_replace_home_dir_with_tilde (const gchar *uri);
guint xed_utils_get_current_workspace (GdkScreen *screen);
guint xed_utils_get_window_workspace (GtkWindow *gtkwindow);
void xed_utils_get_current_viewport (GdkScreen *screen,
gint *x,
gint *y);
gboolean xed_utils_is_valid_location (GFile *location); gboolean xed_utils_is_valid_location (GFile *location);
gboolean xed_utils_get_ui_objects (const gchar *filename, gboolean xed_utils_get_ui_objects (const gchar *filename,

View File

@@ -524,7 +524,6 @@ xed_view_frame_init (XedViewFrame *frame)
{ {
XedDocument *doc; XedDocument *doc;
GtkSourceFile *file; GtkSourceFile *file;
GdkRGBA transparent = {0, 0, 0, 0};
PangoFontDescription *font_desc; PangoFontDescription *font_desc;
frame->priv = xed_view_frame_get_instance_private (frame); frame->priv = xed_view_frame_get_instance_private (frame);
@@ -542,8 +541,6 @@ xed_view_frame_init (XedViewFrame *frame)
g_object_set (frame->priv->map, "font-desc", font_desc, NULL); g_object_set (frame->priv->map, "font-desc", font_desc, NULL);
pango_font_description_free (font_desc); pango_font_description_free (font_desc);
gtk_widget_override_background_color (GTK_WIDGET (frame), 0, &transparent);
doc = xed_view_frame_get_document (frame); doc = xed_view_frame_get_document (frame);
file = xed_document_get_file (doc); file = xed_document_get_file (doc);

View File

@@ -401,7 +401,7 @@ show_line_numbers_menu (GtkWidget *view,
GtkWidget *menu; GtkWidget *menu;
menu = create_line_numbers_menu (view); menu = create_line_numbers_menu (view);
gtk_menu_popup (GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); gtk_menu_popup_at_pointer (GTK_MENU(menu), (GdkEvent *) event);
} }
static gboolean static gboolean

View File

@@ -57,6 +57,7 @@ struct _XedWindowPrivate
GtkWidget *tab_width_button; GtkWidget *tab_width_button;
GtkWidget *tab_width_menu; GtkWidget *tab_width_menu;
GtkWidget *tab_width_item;
GtkWidget *language_button; GtkWidget *language_button;
GtkWidget *language_popover; GtkWidget *language_popover;
GtkWidget *show_side_pane_button; GtkWidget *show_side_pane_button;

View File

@@ -1316,17 +1316,27 @@ tab_width_button_clicked (GtkMenuItem *item,
} }
static void static void
set_tab_spaces_label (XedWindow *window, set_tab_spaces_label (XedView *view,
XedWindow *window,
gboolean use_spaces) gboolean use_spaces)
{ {
gchar *label;
guint tab_width;
tab_width = gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (view));
if (use_spaces) if (use_spaces)
{ {
xed_status_menu_button_set_label (XED_STATUS_MENU_BUTTON (window->priv->tab_width_button), _("Spaces")); label = g_strdup_printf (_("Spaces: %u"), tab_width);
} }
else else
{ {
xed_status_menu_button_set_label (XED_STATUS_MENU_BUTTON (window->priv->tab_width_button), _("Tabs")); label = g_strdup_printf (_("Tabs: %u"), tab_width);
} }
xed_status_menu_button_set_label (XED_STATUS_MENU_BUTTON (window->priv->tab_width_button), label);
g_free (label);
} }
static void static void
@@ -1339,7 +1349,7 @@ use_spaces_toggled (GtkCheckMenuItem *item,
view = xed_window_get_active_view (window); view = xed_window_get_active_view (window);
use_spaces = gtk_check_menu_item_get_active (item); use_spaces = gtk_check_menu_item_get_active (item);
set_tab_spaces_label (window, use_spaces); set_tab_spaces_label (view, window, use_spaces);
g_signal_handler_block (view, window->priv->spaces_instead_of_tabs_id); g_signal_handler_block (view, window->priv->spaces_instead_of_tabs_id);
gtk_source_view_set_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW (view), use_spaces); gtk_source_view_set_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW (view), use_spaces);
@@ -1352,6 +1362,19 @@ typedef struct
guint width; guint width;
} TabWidthDefinition; } TabWidthDefinition;
static void
tab_width_menu_popped_up (GtkMenu *menu,
gpointer flipped_rect,
gpointer final_rect,
gboolean flipped_x,
gboolean flipped_y,
gpointer user_data)
{
XedWindow *window = XED_WINDOW (user_data);
gtk_menu_shell_select_item (GTK_MENU_SHELL (window->priv->tab_width_menu), GTK_WIDGET (window->priv->tab_width_item));
}
static void static void
setup_tab_width_menu (XedWindow *window) setup_tab_width_menu (XedWindow *window)
{ {
@@ -1360,7 +1383,6 @@ setup_tab_width_menu (XedWindow *window)
guint i = 0; guint i = 0;
GtkWidget *item; GtkWidget *item;
gboolean use_spaces;
window->priv->tab_width_menu = gtk_menu_new (); window->priv->tab_width_menu = gtk_menu_new ();
@@ -1390,10 +1412,9 @@ setup_tab_width_menu (XedWindow *window)
gtk_menu_shell_append (GTK_MENU_SHELL (window->priv->tab_width_menu), item); gtk_menu_shell_append (GTK_MENU_SHELL (window->priv->tab_width_menu), item);
gtk_widget_show (item); gtk_widget_show (item);
g_signal_connect(item, "toggled", G_CALLBACK (use_spaces_toggled), window); g_signal_connect (item, "toggled", G_CALLBACK (use_spaces_toggled), window);
use_spaces = g_settings_get_boolean (window->priv->editor_settings, "insert-spaces"); g_signal_connect (window->priv->tab_width_menu, "popped-up", G_CALLBACK (tab_width_menu_popped_up), window);
set_tab_spaces_label (window, use_spaces);
} }
static void static void
@@ -1756,15 +1777,6 @@ set_title (XedWindow *window)
#undef MAX_TITLE_LENGTH #undef MAX_TITLE_LENGTH
static void
set_tab_width_item_blocked (XedWindow *window,
GtkMenuItem *item)
{
g_signal_handlers_block_by_func(item, tab_width_button_clicked, window);
gtk_menu_shell_select_item (GTK_MENU_SHELL (window->priv->tab_width_menu), GTK_WIDGET (item));
g_signal_handlers_unblock_by_func(item, tab_width_button_clicked, window);
}
static void static void
spaces_instead_of_tabs_changed (GObject *object, spaces_instead_of_tabs_changed (GObject *object,
GParamSpec *pspec, GParamSpec *pspec,
@@ -1787,12 +1799,13 @@ tab_width_changed (GObject *object,
GList *items; GList *items;
GList *item; GList *item;
guint new_tab_width; guint new_tab_width;
gchar *label; gboolean use_spaces;
gboolean found = FALSE; gboolean found = FALSE;
items = gtk_container_get_children (GTK_CONTAINER (window->priv->tab_width_menu)); items = gtk_container_get_children (GTK_CONTAINER (window->priv->tab_width_menu));
new_tab_width = gtk_source_view_get_tab_width (GTK_SOURCE_VIEW(object)); new_tab_width = gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (object));
use_spaces = gtk_source_view_get_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW (object));
for (item = items; item; item = item->next) for (item = items; item; item = item->next)
{ {
@@ -1800,7 +1813,11 @@ tab_width_changed (GObject *object,
if (tab_width == new_tab_width) if (tab_width == new_tab_width)
{ {
set_tab_width_item_blocked (window, GTK_MENU_ITEM(item->data)); window->priv->tab_width_item = item->data;
if (gtk_widget_get_realized (window->priv->tab_width_menu))
{
gtk_menu_shell_select_item (GTK_MENU_SHELL (window->priv->tab_width_menu), GTK_WIDGET (item->data));
}
found = TRUE; found = TRUE;
} }
@@ -1814,7 +1831,11 @@ tab_width_changed (GObject *object,
text = g_strdup_printf ("%u", new_tab_width); text = g_strdup_printf ("%u", new_tab_width);
gtk_menu_item_set_label (GTK_MENU_ITEM(item->data), text); gtk_menu_item_set_label (GTK_MENU_ITEM(item->data), text);
set_tab_width_item_blocked (window, GTK_MENU_ITEM(item->data)); window->priv->tab_width_item = item->data;
if (gtk_widget_get_realized (window->priv->tab_width_menu))
{
gtk_menu_shell_select_item (GTK_MENU_SHELL (window->priv->tab_width_menu), GTK_WIDGET (item->data));
}
gtk_widget_show (GTK_WIDGET(item->data)); gtk_widget_show (GTK_WIDGET(item->data));
} }
else else
@@ -1826,10 +1847,8 @@ tab_width_changed (GObject *object,
} }
} }
label = g_strdup_printf (_("Tab Width: %u"), new_tab_width); set_tab_spaces_label (XED_VIEW (object), window, use_spaces);
xed_status_menu_button_set_label (XED_STATUS_MENU_BUTTON (window->priv->tab_width_button), label);
g_free (label);
g_list_free (items); g_list_free (items);
} }
@@ -2346,7 +2365,22 @@ on_fullscreen_controls_leave_notify_event (GtkWidget *widget,
GdkEventCrossing *event, GdkEventCrossing *event,
XedWindow *window) XedWindow *window)
{ {
gtk_revealer_set_reveal_child (GTK_REVEALER (window->priv->fullscreen_controls), FALSE); GdkWindow *gdk_window;
GdkDevice *device;
GdkSeat *seat;
gint x, y;
seat = gdk_display_get_default_seat (gdk_display_get_default ());
device = gdk_seat_get_pointer (seat);
gdk_window = gtk_widget_get_parent_window (widget);
gdk_window_get_device_position (gdk_window, device, &x, &y, NULL);
// sometimes the leave event is erroneously triggered when y = 0
if (y != 0)
{
gtk_revealer_set_reveal_child (GTK_REVEALER (window->priv->fullscreen_controls), FALSE);
}
return FALSE; return FALSE;
} }
@@ -2718,19 +2752,11 @@ notebook_tab_removed (XedNotebook *notebook,
gtk_widget_hide (window->priv->language_button); gtk_widget_hide (window->priv->language_button);
} }
if (!window->priv->removing_tabs) if (!window->priv->removing_tabs || window->priv->num_tabs == 0)
{ {
update_documents_list_menu (window); update_documents_list_menu (window);
update_next_prev_doc_sensitivity_per_window (window); update_next_prev_doc_sensitivity_per_window (window);
} }
else
{
if (window->priv->num_tabs == 0)
{
update_documents_list_menu (window);
update_next_prev_doc_sensitivity_per_window (window);
}
}
update_sensitivity_according_to_open_tabs (window); update_sensitivity_according_to_open_tabs (window);
@@ -2801,20 +2827,20 @@ show_notebook_popup_menu (GtkNotebook *notebook,
#endif #endif
if (event != NULL) if (event != NULL)
{ {
gtk_menu_popup (GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); gtk_menu_popup_at_pointer (GTK_MENU(menu), (GdkEvent *) event);
} }
else else
{ {
GtkWidget *tab; GtkWidget *tab;
GtkWidget *tab_label; GtkWidget *tab_label;
tab = GTK_WIDGET(xed_window_get_active_tab (window)); tab = GTK_WIDGET (xed_window_get_active_tab (window));
g_return_val_if_fail(tab != NULL, FALSE); g_return_val_if_fail (tab != NULL, FALSE);
tab_label = gtk_notebook_get_tab_label (notebook, tab); tab_label = gtk_notebook_get_tab_label (notebook, tab);
gtk_menu_popup (GTK_MENU(menu), NULL, NULL, xed_utils_menu_position_under_widget, tab_label, 0, gtk_menu_popup_at_widget (GTK_MENU (menu), tab_label, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL);
gtk_get_current_event_time ());
gtk_menu_shell_select_first (GTK_MENU_SHELL(menu), FALSE); gtk_menu_shell_select_first (GTK_MENU_SHELL(menu), FALSE);
} }