Commit 2e04355a authored by Victor Ananjevsky's avatar Victor Ananjevsky

add --text-width option

parent 07059691
...@@ -123,6 +123,9 @@ Set the tab number for plugged dialog. See \fINOTEBOOK\fP section for more. ...@@ -123,6 +123,9 @@ Set the tab number for plugged dialog. See \fINOTEBOOK\fP section for more.
.B \-\-text=\fISTRING\fP .B \-\-text=\fISTRING\fP
Set the dialog text. Set the dialog text.
.TP .TP
.B \-\-text-width=\fINUMBER\fP
Set the maximum dialog text width in characters.
.TP
.B \-\-text-align=\fITYPE\fP .B \-\-text-align=\fITYPE\fP
Set type of dialog text justification. \fITYPE\fP may be \fIleft\fP, \fIright\fP, \fIcenter\fP or \fIfill\fP. Set type of dialog text justification. \fITYPE\fP may be \fIleft\fP, \fIright\fP, \fIcenter\fP or \fIfill\fP.
.TP .TP
......
...@@ -195,12 +195,6 @@ create_layout (GtkWidget *dlg) ...@@ -195,12 +195,6 @@ create_layout (GtkWidget *dlg)
gchar *buf = g_strcompress (options.data.dialog_text); gchar *buf = g_strcompress (options.data.dialog_text);
text = gtk_label_new (NULL); text = gtk_label_new (NULL);
if (!options.data.no_markup)
gtk_label_set_markup (GTK_LABEL (text), buf);
else
gtk_label_set_text (GTK_LABEL (text), buf);
g_free (buf);
gtk_widget_set_name (text, "yad-dialog-label"); gtk_widget_set_name (text, "yad-dialog-label");
gtk_label_set_line_wrap (GTK_LABEL (text), TRUE); gtk_label_set_line_wrap (GTK_LABEL (text), TRUE);
gtk_label_set_selectable (GTK_LABEL (text), options.data.selectable_labels); gtk_label_set_selectable (GTK_LABEL (text), options.data.selectable_labels);
...@@ -208,6 +202,15 @@ create_layout (GtkWidget *dlg) ...@@ -208,6 +202,15 @@ create_layout (GtkWidget *dlg)
gtk_widget_set_state_flags (text, GTK_STATE_FLAG_NORMAL, FALSE); gtk_widget_set_state_flags (text, GTK_STATE_FLAG_NORMAL, FALSE);
gtk_label_set_xalign (GTK_LABEL (text), options.data.text_align); gtk_label_set_xalign (GTK_LABEL (text), options.data.text_align);
gtk_widget_set_can_focus (text, FALSE); gtk_widget_set_can_focus (text, FALSE);
if (options.data.text_width > 0)
gtk_label_set_max_width_chars (GTK_LABEL (text), options.data.text_width);
if (!options.data.no_markup)
gtk_label_set_markup (GTK_LABEL (text), buf);
else
gtk_label_set_text (GTK_LABEL (text), buf);
g_free (buf);
} }
} }
......
...@@ -112,6 +112,8 @@ static GOptionEntry general_options[] = { ...@@ -112,6 +112,8 @@ static GOptionEntry general_options[] = {
N_("Show remaining time indicator (top, bottom, left, right)"), N_("POS") }, N_("Show remaining time indicator (top, bottom, left, right)"), N_("POS") },
{ "text", 0, G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &options.data.dialog_text, { "text", 0, G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &options.data.dialog_text,
N_("Set the dialog text"), N_("TEXT") }, N_("Set the dialog text"), N_("TEXT") },
{ "text-width", 0, G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_INT, &options.data.text_width,
N_("Set the dialog text width in characters"), N_("NUMBER") },
{ "text-align", 0, G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_CALLBACK, set_text_align, { "text-align", 0, G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_CALLBACK, set_text_align,
N_("Set the dialog text alignment (left, center, right, fill)"), N_("TYPE") }, N_("Set the dialog text alignment (left, center, right, fill)"), N_("TYPE") },
{ "image", 0, G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_FILENAME, &options.data.dialog_image, { "image", 0, G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_FILENAME, &options.data.dialog_image,
...@@ -1508,6 +1510,7 @@ yad_options_init (void) ...@@ -1508,6 +1510,7 @@ yad_options_init (void)
options.data.posy = 0; options.data.posy = 0;
options.data.geometry = NULL; options.data.geometry = NULL;
options.data.dialog_text = NULL; options.data.dialog_text = NULL;
options.data.text_width = 0;
options.data.text_align = GTK_JUSTIFY_LEFT; options.data.text_align = GTK_JUSTIFY_LEFT;
options.data.dialog_image = NULL; options.data.dialog_image = NULL;
options.data.icon_theme = NULL; options.data.icon_theme = NULL;
......
...@@ -221,6 +221,7 @@ typedef struct { ...@@ -221,6 +221,7 @@ typedef struct {
guint timeout; guint timeout;
gchar *to_indicator; gchar *to_indicator;
gchar *dialog_text; gchar *dialog_text;
guint text_width;
gdouble text_align; gdouble text_align;
gchar *dialog_image; gchar *dialog_image;
gchar *icon_theme; gchar *icon_theme;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment