Implement cm_skip_leading_dot() to avoid code duplication
This commit is contained in:
parent
973c82fdae
commit
170163cbab
1 changed files with 10 additions and 5 deletions
|
@ -528,6 +528,12 @@ static void cm_button_delete_all_clicked_cb(GtkToolButton *button, CookieManager
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const gchar *cm_skip_leading_dot(const gchar *text)
|
||||||
|
{
|
||||||
|
return (*text == '.') ? text + 1 : text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void cm_tree_drag_data_get_cb(GtkWidget *widget, GdkDragContext *drag_context,
|
static void cm_tree_drag_data_get_cb(GtkWidget *widget, GdkDragContext *drag_context,
|
||||||
GtkSelectionData *data, guint info, guint ltime,
|
GtkSelectionData *data, guint info, guint ltime,
|
||||||
CookieManagerPage *cmp)
|
CookieManagerPage *cmp)
|
||||||
|
@ -554,7 +560,8 @@ static void cm_tree_drag_data_get_cb(GtkWidget *widget, GdkDragContext *drag_con
|
||||||
if (gtk_tree_store_iter_is_valid(priv->store, &iter_store))
|
if (gtk_tree_store_iter_is_valid(priv->store, &iter_store))
|
||||||
{
|
{
|
||||||
SoupCookie *cookie;
|
SoupCookie *cookie;
|
||||||
gchar *name, *text;
|
gchar *name;
|
||||||
|
const gchar *text;
|
||||||
|
|
||||||
gtk_tree_model_get(model, &iter,
|
gtk_tree_model_get(model, &iter,
|
||||||
COOKIE_MANAGER_COL_NAME, &name,
|
COOKIE_MANAGER_COL_NAME, &name,
|
||||||
|
@ -563,8 +570,7 @@ static void cm_tree_drag_data_get_cb(GtkWidget *widget, GdkDragContext *drag_con
|
||||||
|
|
||||||
if (cookie == NULL && name != NULL)
|
if (cookie == NULL && name != NULL)
|
||||||
{
|
{
|
||||||
/* skip a leading dot */
|
text = cm_skip_leading_dot(name);
|
||||||
text = (*name == '.') ? name + 1 : name;
|
|
||||||
|
|
||||||
gtk_selection_data_set_text(data, text, -1);
|
gtk_selection_data_set_text(data, text, -1);
|
||||||
}
|
}
|
||||||
|
@ -613,8 +619,7 @@ static gchar *cm_get_domain_description_text(const gchar *domain, gint cookie_co
|
||||||
{
|
{
|
||||||
gchar *str, *text;
|
gchar *str, *text;
|
||||||
|
|
||||||
if (*domain == '.')
|
domain = cm_skip_leading_dot(domain);
|
||||||
domain++; /* skip a leading dot */
|
|
||||||
|
|
||||||
text = g_markup_printf_escaped(
|
text = g_markup_printf_escaped(
|
||||||
_("<b>Domain</b>: %s\n<b>Cookies</b>: %d"),
|
_("<b>Domain</b>: %s\n<b>Cookies</b>: %d"),
|
||||||
|
|
Loading…
Reference in a new issue