gtk: Use appropriate constness for variables
This commit is contained in:
@@ -1531,7 +1531,7 @@ gtk_accelerator_name (guint accelerator_key,
|
||||
static const gchar text_hyper[] = "<Hyper>";
|
||||
GdkModifierType saved_mods;
|
||||
guint l;
|
||||
gchar *keyval_name;
|
||||
const char *keyval_name;
|
||||
gchar *accelerator;
|
||||
|
||||
accelerator_mods &= GDK_MODIFIER_MASK;
|
||||
|
||||
@@ -157,8 +157,8 @@ gtk_im_context_simple_init_compose_table (GtkIMContextSimple *im_context_simple)
|
||||
const gchar *locale;
|
||||
gchar **langs = NULL;
|
||||
gchar **lang = NULL;
|
||||
gchar * const sys_langs[] = { "el_gr", "fi_fi", "pt_br", NULL };
|
||||
gchar * const *sys_lang = NULL;
|
||||
const char * const sys_langs[] = { "el_gr", "fi_fi", "pt_br", NULL };
|
||||
const char * const *sys_lang = NULL;
|
||||
gchar *x11_compose_file_dir = get_x11_compose_file_dir ();
|
||||
|
||||
path = g_build_filename (g_get_user_config_dir (), "gtk-3.0", "Compose", NULL);
|
||||
|
||||
@@ -224,7 +224,7 @@ static void
|
||||
gtk_lock_button_init (GtkLockButton *button)
|
||||
{
|
||||
GtkLockButtonPrivate *priv;
|
||||
gchar *names[3];
|
||||
const char *names[3];
|
||||
GtkStyleContext *context;
|
||||
|
||||
button->priv = priv = gtk_lock_button_get_instance_private (button);
|
||||
@@ -234,12 +234,12 @@ gtk_lock_button_init (GtkLockButton *button)
|
||||
names[0] = "changes-allow-symbolic";
|
||||
names[1] = "changes-allow";
|
||||
names[2] = NULL;
|
||||
priv->icon_unlock = g_themed_icon_new_from_names (names, -1);
|
||||
priv->icon_unlock = g_themed_icon_new_from_names ((char **) names, -1);
|
||||
|
||||
names[0] = "changes-prevent-symbolic";
|
||||
names[1] = "changes-prevent";
|
||||
names[2] = NULL;
|
||||
priv->icon_lock = g_themed_icon_new_from_names (names, -1);
|
||||
priv->icon_lock = g_themed_icon_new_from_names ((char **) names, -1);
|
||||
|
||||
update_state (button);
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ gtk_popover_menu_add (GtkContainer *container,
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *name;
|
||||
const char *name;
|
||||
|
||||
if (gtk_stack_get_child_by_name (GTK_STACK (stack), "main"))
|
||||
name = "submenu";
|
||||
|
||||
@@ -2216,12 +2216,12 @@ update_collate_icon (GtkToggleButton *toggle_button,
|
||||
}
|
||||
|
||||
static void
|
||||
paint_page (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gint x,
|
||||
gint y,
|
||||
gchar *text,
|
||||
gint text_x)
|
||||
paint_page (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gint x,
|
||||
gint y,
|
||||
const char *text,
|
||||
gint text_x)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
gint width, height;
|
||||
@@ -3085,14 +3085,14 @@ update_number_up_layout (GtkPrintUnixDialog *dialog)
|
||||
priv->number_up_layout_n_option = gtk_printer_option_set_lookup (set, "gtk-n-up-layout");
|
||||
if (priv->number_up_layout_n_option == NULL)
|
||||
{
|
||||
char *n_up_layout[] = { "lrtb", "lrbt", "rltb", "rlbt", "tblr", "tbrl", "btlr", "btrl" };
|
||||
const char *n_up_layout[] = { "lrtb", "lrbt", "rltb", "rlbt", "tblr", "tbrl", "btlr", "btrl" };
|
||||
/* Translators: These strings name the possible arrangements of
|
||||
* multiple pages on a sheet when printing (same as in gtkprintbackendcups.c)
|
||||
*/
|
||||
char *n_up_layout_display[] = { N_("Left to right, top to bottom"), N_("Left to right, bottom to top"),
|
||||
N_("Right to left, top to bottom"), N_("Right to left, bottom to top"),
|
||||
N_("Top to bottom, left to right"), N_("Top to bottom, right to left"),
|
||||
N_("Bottom to top, left to right"), N_("Bottom to top, right to left") };
|
||||
const char *n_up_layout_display[] = { N_("Left to right, top to bottom"), N_("Left to right, bottom to top"),
|
||||
N_("Right to left, top to bottom"), N_("Right to left, bottom to top"),
|
||||
N_("Top to bottom, left to right"), N_("Top to bottom, right to left"),
|
||||
N_("Bottom to top, left to right"), N_("Bottom to top, right to left") };
|
||||
int i;
|
||||
|
||||
priv->number_up_layout_n_option = gtk_printer_option_new ("gtk-n-up-layout",
|
||||
|
||||
@@ -130,23 +130,28 @@ GdkAtom
|
||||
gtk_text_buffer_register_serialize_tagset (GtkTextBuffer *buffer,
|
||||
const gchar *tagset_name)
|
||||
{
|
||||
gchar *mime_type = "application/x-gtk-text-buffer-rich-text";
|
||||
GdkAtom format;
|
||||
gchar *mime_type;
|
||||
GdkAtom format;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), GDK_NONE);
|
||||
g_return_val_if_fail (tagset_name == NULL || *tagset_name != '\0', GDK_NONE);
|
||||
|
||||
if (tagset_name)
|
||||
mime_type =
|
||||
g_strdup_printf ("application/x-gtk-text-buffer-rich-text;format=%s",
|
||||
tagset_name);
|
||||
{
|
||||
mime_type = g_strconcat ("application/x-gtk-text-buffer-rich-text;format=",
|
||||
tagset_name,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
mime_type = g_strdup ("application/x-gtk-text-buffer-rich-text");
|
||||
}
|
||||
|
||||
format = gtk_text_buffer_register_serialize_format (buffer, mime_type,
|
||||
_gtk_text_buffer_serialize_rich_text,
|
||||
NULL, NULL);
|
||||
|
||||
if (tagset_name)
|
||||
g_free (mime_type);
|
||||
g_free (mime_type);
|
||||
|
||||
return format;
|
||||
}
|
||||
@@ -214,23 +219,28 @@ GdkAtom
|
||||
gtk_text_buffer_register_deserialize_tagset (GtkTextBuffer *buffer,
|
||||
const gchar *tagset_name)
|
||||
{
|
||||
gchar *mime_type = "application/x-gtk-text-buffer-rich-text";
|
||||
gchar *mime_type;
|
||||
GdkAtom format;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), GDK_NONE);
|
||||
g_return_val_if_fail (tagset_name == NULL || *tagset_name != '\0', GDK_NONE);
|
||||
|
||||
if (tagset_name)
|
||||
mime_type =
|
||||
g_strdup_printf ("application/x-gtk-text-buffer-rich-text;format=%s",
|
||||
tagset_name);
|
||||
{
|
||||
mime_type = g_strconcat ("application/x-gtk-text-buffer-rich-text;format=",
|
||||
tagset_name,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
mime_type = g_strdup ("application/x-gtk-text-buffer-rich-text");
|
||||
}
|
||||
|
||||
format = gtk_text_buffer_register_deserialize_format (buffer, mime_type,
|
||||
_gtk_text_buffer_deserialize_rich_text,
|
||||
NULL, NULL);
|
||||
|
||||
if (tagset_name)
|
||||
g_free (mime_type);
|
||||
g_free (mime_type);
|
||||
|
||||
return format;
|
||||
}
|
||||
|
||||
@@ -437,23 +437,24 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
else
|
||||
{
|
||||
gboolean elide;
|
||||
const char *orig_label;
|
||||
gchar *label_text;
|
||||
|
||||
if (button->priv->label_text)
|
||||
{
|
||||
label_text = button->priv->label_text;
|
||||
orig_label = button->priv->label_text;
|
||||
elide = button->priv->use_underline;
|
||||
}
|
||||
else
|
||||
{
|
||||
label_text = "";
|
||||
orig_label = "";
|
||||
elide = FALSE;
|
||||
}
|
||||
|
||||
if (elide)
|
||||
label_text = _gtk_toolbar_elide_underscores (label_text);
|
||||
label_text = _gtk_toolbar_elide_underscores (orig_label);
|
||||
else
|
||||
label_text = g_strdup (label_text);
|
||||
label_text = g_strdup (orig_label);
|
||||
|
||||
label = gtk_label_new (label_text);
|
||||
|
||||
|
||||
@@ -2264,14 +2264,11 @@ gtk_window_set_title_internal (GtkWindow *window,
|
||||
g_free (priv->title);
|
||||
priv->title = new_title;
|
||||
|
||||
if (new_title == NULL)
|
||||
new_title = "";
|
||||
|
||||
if (_gtk_widget_get_realized (widget))
|
||||
gdk_window_set_title (_gtk_widget_get_window (widget), new_title);
|
||||
gdk_window_set_title (_gtk_widget_get_window (widget), new_title != NULL ? new_title : "");
|
||||
|
||||
if (update_titlebar && GTK_IS_HEADER_BAR (priv->title_box))
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (priv->title_box), new_title);
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (priv->title_box), new_title != NULL ? new_title : "");
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_TITLE]);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ static gboolean ignore_theme_index = FALSE;
|
||||
static gboolean quiet = FALSE;
|
||||
static gboolean index_only = TRUE;
|
||||
static gboolean validate = FALSE;
|
||||
static gchar *var_name = "-";
|
||||
static gchar *var_name = (gchar *) "-";
|
||||
|
||||
/* Quite ugly - if we just add the c file to the
|
||||
* list of sources in Makefile.am, libtool complains.
|
||||
|
||||
Reference in New Issue
Block a user