xed-searchbar.c/h: Clean up styling a bit
This commit is contained in:
parent
5267b52c70
commit
6a997b1b79
|
@ -21,12 +21,14 @@
|
||||||
/* Signals */
|
/* Signals */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SHOW_REPLACE, LAST_SIGNAL
|
SHOW_REPLACE,
|
||||||
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _XedSearchbarPrivate
|
struct _XedSearchbarPrivate
|
||||||
{
|
{
|
||||||
gboolean show_replace;
|
gboolean show_replace;
|
||||||
|
|
||||||
GtkWidget *revealer;
|
GtkWidget *revealer;
|
||||||
GtkWidget *grid;
|
GtkWidget *grid;
|
||||||
GtkWidget *search_label;
|
GtkWidget *search_label;
|
||||||
|
@ -65,20 +67,24 @@ text_found (XedWindow *window,
|
||||||
{
|
{
|
||||||
if (occurrences > 1)
|
if (occurrences > 1)
|
||||||
{
|
{
|
||||||
xed_statusbar_flash_message (XED_STATUSBAR(window->priv->statusbar), window->priv->generic_message_cid,
|
xed_statusbar_flash_message (XED_STATUSBAR (window->priv->statusbar),
|
||||||
ngettext ("Found and replaced %d occurrence", "Found and replaced %d occurrences", occurrences),
|
window->priv->generic_message_cid,
|
||||||
|
ngettext ("Found and replaced %d occurrence", "Found and replaced %d occurrences",
|
||||||
|
occurrences),
|
||||||
occurrences);
|
occurrences);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (occurrences == 1)
|
if (occurrences == 1)
|
||||||
{
|
{
|
||||||
xed_statusbar_flash_message (XED_STATUSBAR(window->priv->statusbar), window->priv->generic_message_cid,
|
xed_statusbar_flash_message (XED_STATUSBAR (window->priv->statusbar),
|
||||||
|
window->priv->generic_message_cid,
|
||||||
_("Found and replaced one occurrence"));
|
_("Found and replaced one occurrence"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xed_statusbar_flash_message (XED_STATUSBAR(window->priv->statusbar), window->priv->generic_message_cid,
|
xed_statusbar_flash_message (XED_STATUSBAR (window->priv->statusbar),
|
||||||
|
window->priv->generic_message_cid,
|
||||||
" ");
|
" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +97,8 @@ text_not_found (XedWindow *window,
|
||||||
gchar *searched;
|
gchar *searched;
|
||||||
|
|
||||||
searched = xed_utils_str_end_truncate (text, MAX_MSG_LENGTH);
|
searched = xed_utils_str_end_truncate (text, MAX_MSG_LENGTH);
|
||||||
xed_statusbar_flash_message (XED_STATUSBAR(window->priv->statusbar), window->priv->generic_message_cid,
|
xed_statusbar_flash_message (XED_STATUSBAR (window->priv->statusbar),
|
||||||
|
window->priv->generic_message_cid,
|
||||||
_("\"%s\" not found"), searched);
|
_("\"%s\" not found"), searched);
|
||||||
g_free (searched);
|
g_free (searched);
|
||||||
}
|
}
|
||||||
|
@ -114,10 +121,12 @@ run_search (XedView *view,
|
||||||
|
|
||||||
if (!search_backwards)
|
if (!search_backwards)
|
||||||
{
|
{
|
||||||
if (jump_to_next_result) {
|
if (jump_to_next_result)
|
||||||
|
{
|
||||||
found = xed_document_search_forward (doc, &end_iter, NULL, &match_start, &match_end);
|
found = xed_document_search_forward (doc, &end_iter, NULL, &match_start, &match_end);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
found = xed_document_search_forward (doc, &start_iter, NULL, &match_start, &match_end);
|
found = xed_document_search_forward (doc, &start_iter, NULL, &match_start, &match_end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,9 +323,9 @@ do_replace (XedSearchbar *searchbar)
|
||||||
|
|
||||||
match_case = xed_searchbar_get_match_case (searchbar);
|
match_case = xed_searchbar_get_match_case (searchbar);
|
||||||
|
|
||||||
if ((selected_text == NULL)
|
if ((selected_text == NULL) ||
|
||||||
|| (match_case && (strcmp (selected_text, unescaped_search_text) != 0))
|
(match_case && (strcmp (selected_text, unescaped_search_text) != 0)) ||
|
||||||
|| (!match_case && !g_utf8_caselessnmatch (selected_text,
|
(!match_case && !g_utf8_caselessnmatch (selected_text,
|
||||||
unescaped_search_text,
|
unescaped_search_text,
|
||||||
strlen (selected_text),
|
strlen (selected_text),
|
||||||
strlen (unescaped_search_text)) != 0))
|
strlen (unescaped_search_text)) != 0))
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
/*
|
|
||||||
* Type checking and casting macros
|
|
||||||
*/
|
|
||||||
#define XED_TYPE_SEARCHBAR (xed_searchbar_get_type())
|
#define XED_TYPE_SEARCHBAR (xed_searchbar_get_type())
|
||||||
#define XED_SEARCHBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XED_TYPE_SEARCHBAR, XedSearchbar))
|
#define XED_SEARCHBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XED_TYPE_SEARCHBAR, XedSearchbar))
|
||||||
#define XED_SEARCHBAR_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XED_TYPE_SEARCHBAR, XedSearchbar const))
|
#define XED_SEARCHBAR_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XED_TYPE_SEARCHBAR, XedSearchbar const))
|
||||||
|
@ -18,13 +15,9 @@ G_BEGIN_DECLS
|
||||||
#define XED_IS_SEARCHBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_SEARCHBAR))
|
#define XED_IS_SEARCHBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_SEARCHBAR))
|
||||||
#define XED_SEARCHBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XED_TYPE_SEARCHBAR, XedSearchbarClass))
|
#define XED_SEARCHBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XED_TYPE_SEARCHBAR, XedSearchbarClass))
|
||||||
|
|
||||||
/* Private structure type */
|
|
||||||
typedef struct _XedSearchbarPrivate XedSearchbarPrivate;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Main object structure
|
|
||||||
*/
|
|
||||||
typedef struct _XedSearchbar XedSearchbar;
|
typedef struct _XedSearchbar XedSearchbar;
|
||||||
|
typedef struct _XedSearchbarPrivate XedSearchbarPrivate;
|
||||||
|
typedef struct _XedSearchbarClass XedSearchbarClass;
|
||||||
|
|
||||||
struct _XedSearchbar
|
struct _XedSearchbar
|
||||||
{
|
{
|
||||||
|
@ -35,11 +28,6 @@ struct _XedSearchbar
|
||||||
XedSearchbarPrivate *priv;
|
XedSearchbarPrivate *priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Class definition
|
|
||||||
*/
|
|
||||||
typedef struct _XedSearchbarClass XedSearchbarClass;
|
|
||||||
|
|
||||||
struct _XedSearchbarClass
|
struct _XedSearchbarClass
|
||||||
{
|
{
|
||||||
GtkBoxClass parent_class;
|
GtkBoxClass parent_class;
|
||||||
|
@ -55,9 +43,6 @@ enum
|
||||||
XED_SEARCHBAR_REPLACE_ALL_RESPONSE
|
XED_SEARCHBAR_REPLACE_ALL_RESPONSE
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Public methods
|
|
||||||
*/
|
|
||||||
GType xed_searchbar_get_type (void) G_GNUC_CONST;
|
GType xed_searchbar_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GtkWidget *xed_searchbar_new (GtkWindow *parent, gboolean show_replace);
|
GtkWidget *xed_searchbar_new (GtkWindow *parent, gboolean show_replace);
|
||||||
|
|
Loading…
Reference in New Issue